Package org.codehaus.commons.compiler
Interface ISimpleCompiler
-
- All Superinterfaces:
ICookable
- All Known Implementing Classes:
ClassBodyEvaluator,ClassBodyEvaluator,ExpressionEvaluator,ExpressionEvaluator,ScriptEvaluator,ScriptEvaluator,SimpleCompiler,SimpleCompiler
public interface ISimpleCompiler extends ICookable
A simplified Java™ compiler that can compile only a single compilation unit. (A "compilation unit" is the document stored in a ".java" file.)Opposed to a normal ".java" file, you can declare multiple public classes here.
To set up an
ISimpleCompilerobject, proceed as follows:-
Create an
ISimpleCompiler-implementing object -
Optionally set an alternate parent class loader through
ICookable.setParentClassLoader(ClassLoader). -
Call any of the
ICookable.cook(String, Reader)methods to scan, parse, compile and load the compilation unit into the JVM. -
Call
getClassLoader()to obtain aClassLoaderthat you can use to access the compiled classes.
-
-
Field Summary
-
Fields inherited from interface org.codehaus.commons.compiler.ICookable
BOOT_CLASS_LOADER, SYSTEM_PROPERTY_SOURCE_DEBUGGING_DIR, SYSTEM_PROPERTY_SOURCE_DEBUGGING_ENABLE
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.lang.ClassLoadergetClassLoader()Returns aClassLoaderobject through which the previously compiled classes can be accessed.
-
-
-
Method Detail
-
getClassLoader
java.lang.ClassLoader getClassLoader()
Returns aClassLoaderobject through which the previously compiled classes can be accessed. ThisClassLoadercan be used for subsequentISimpleCompilers in order to compile compilation units that use types (e.g. declare derived types) declared in the previous one.This method must only be called after exactly on of the
ICookable.cook(String, java.io.Reader)methods was called.
-
-