|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface MemoryClassFactory
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 |
---|
void setClassLoader(java.lang.ClassLoader cl)
cl
- class loadervoid 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.Stringjava.util.Map getOutput()
java.lang.Class loadClass(java.lang.String className) throws java.lang.ClassNotFoundException
name
- of class to load
java.lang.ClassNotFoundException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |