public class InMemoryCompiler extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
InMemoryCompiler.CompilerException |
| Constructor and Description |
|---|
InMemoryCompiler() |
| Modifier and Type | Method and Description |
|---|---|
CompilationPackage |
compile(Map<String,String> classesToCompile)
Given a map of class FQDN and its source code, this method compiles the code and
returns a Compilation Package that encapsulates it.
|
CompilationPackage |
singleCompile(String className,
String code)
Compiles a single class.
|
public CompilationPackage singleCompile(String className, String code) throws InMemoryCompiler.CompilerException
Example code:
try {
DynamicCompiler compiler = new DynamicCompiler();
CompilationPackage pkg = compiler.singleCompile(
"public class HelloWorld {\n"+
" public static void main(String[] args) {\n"+
" System.out.println(\"hello,world!\");\n"+
" }\n"+
"}\n");
}
catch(CompilerException e) {
// face it or throw it away
}
className - Ruleset namecode - Rule class codeInMemoryCompiler.CompilerException - Thrown when a compiler exception occurspublic CompilationPackage compile(Map<String,String> classesToCompile) throws InMemoryCompiler.CompilerException
classesToCompile - Map of className/classSource to compileInMemoryCompiler.CompilerException - Thrown when a compiler exception occursCopyright © 2016. All rights reserved.