Last active
June 6, 2016 12:55
-
-
Save roryl/c8c5fd83bf367c70cd09 to your computer and use it in GitHub Desktop.
Lucee - Integrating with native Java libraries
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cfscript> | |
javaArray = createObject("java", "java.util.ArrayList"); | |
</cfscript> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cfscript> | |
javaArray = javaArray.init(); | |
</cfscript> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cfscript> | |
echo(createObject("java", "java.util.ArrayList").init().size()); //outputs the size of the array | |
</cfscript> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cfscript> | |
//Load a comma separated list of jar files | |
Handlebars = createObject('java','com.github.jknack.handlebars.Handlebars','handlebars-4.0.3.jar,commons-lang3-3.1.jar,antlr4-runtime-4.5.1-1.jar').init(); | |
//Load an array of jar files | |
Handlebars = createObject('java','com.github.jknack.handlebars.Handlebars',['handlebars-4.0.3.jar','commons-lang3-3.1.jar','antlr4-runtime-4.5.1-1.jar']).init(); | |
//Dump the created java object | |
writeDump(Handlebars); | |
</cfscript> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* My xUnit Test | |
*/ | |
component extends="testbox.system.BaseSpec"{ | |
/*********************************** LIFE CYCLE Methods ***********************************/ | |
// executes before all test cases | |
function beforeTests(){ | |
} | |
// executes after all test cases | |
function afterTests(){ | |
} | |
// executes before every test case | |
function setup( currentMethod ){ | |
} | |
// executes after every test case | |
function teardown( currentMethod ){ | |
} | |
/*********************************** TEST CASES BELOW ***********************************/ | |
function checkAllSyntaxTest(){ | |
var files = directoryList(""); | |
for(file IN files){ | |
if(file CONTAINS ".cfm"){ | |
include template="#getFileFromPath(file)#"; | |
} | |
} | |
} | |
function outputJavaTest(){ | |
savecontent variable="myContent" { | |
include template="output_java.cfm"; | |
} | |
expect(myContent).toBe("0"); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cfscript> | |
javaArray = createObject("java", "java.util.ArrayList"); | |
javaArray = javaArray.init(); | |
echo(javaArray.size()); //outputs the size of the array, which is 0 | |
</cfscript> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment