|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Interface to a utility object that supports compiling and loading Java source code in memory
Example: JavaCompiler compiler = ... JavaCompilerErrorHandler errorHandler = ... MemoryClassFactory factory = ... String source = "public class Foo { public void foo() {} }"; Map map = new HashMap(); map.put("Foo", source); factory.setInput(map); compiler.compile(factory, factory, factory, errorHandler); Class clazz = factory.loadClass("Foo");
Method Summary | |
java.util.Map |
getOutput()
Get the compiled output files as a map |
java.lang.Class |
loadClass(java.lang.String className)
Convenience method to load a class you just compiled in memory |
void |
setClassLoader(java.lang.ClassLoader cl)
Set the class loader to use to locate existing classes. |
void |
setInput(java.util.Map sourceMap)
Set the input source files to be compiled. |
Methods inherited from interface org.tempuri.javac.JavaClassReaderFactory |
getClassReader |
Methods inherited from interface org.tempuri.javac.JavaSourceReaderFactory |
getSourceReader |
Methods inherited from interface org.tempuri.javac.JavaClassWriterFactory |
getClassWriter |
Method Detail |
public void setClassLoader(java.lang.ClassLoader cl)
cl
- class loaderpublic void setInput(java.util.Map sourceMap)
sourceMap
- a map of {className -> source code} pairs. Both the keys and values of the map must be instances of java.lang.Stringpublic java.util.Map getOutput()
public java.lang.Class loadClass(java.lang.String className) throws java.lang.ClassNotFoundException
java.lang.ClassNotFoundException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |