Package org.codehaus.janino
Class JavaSourceIClassLoader
- java.lang.Object
-
- org.codehaus.janino.IClassLoader
-
- org.codehaus.janino.JavaSourceIClassLoader
-
public final class JavaSourceIClassLoader extends IClassLoader
ThisIClassLoaderfinds, scans and parses compilation units.Notice that it does not compile them!
-
-
Field Summary
-
Fields inherited from class org.codehaus.janino.IClassLoader
JAVA_IO_SERIALIZABLE, JAVA_LANG_ASSERTIONERROR, JAVA_LANG_BOOLEAN, JAVA_LANG_BYTE, JAVA_LANG_CHARACTER, JAVA_LANG_CLASS, JAVA_LANG_CLONEABLE, JAVA_LANG_DOUBLE, JAVA_LANG_ERROR, JAVA_LANG_FLOAT, JAVA_LANG_INTEGER, JAVA_LANG_LONG, JAVA_LANG_OBJECT, JAVA_LANG_OVERRIDE, JAVA_LANG_RUNTIMEEXCEPTION, JAVA_LANG_SHORT, JAVA_LANG_STRING, JAVA_LANG_THROWABLE
-
-
Constructor Summary
Constructors Constructor Description JavaSourceIClassLoader(ResourceFinder sourceFinder, java.lang.String optionalCharacterEncoding, java.util.Set unitCompilers, IClassLoader optionalParentIClassLoader)Notice that theunitCompilersset is both read and written by theJavaSourceIClassLoader: As it searches forIClasses, it looks intounitCompilersfor class declarations, and as it opens, scans and parses compilation units on-the-fly, it adds them tounitCompilers.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description IClassfindIClass(java.lang.String fieldDescriptor)voidsetCharacterEncoding(java.lang.String optionalCharacterEncoding)voidsetCompileErrorHandler(UnitCompiler.ErrorHandler optionalCompileErrorHandler)voidsetSourceFinder(ResourceFinder pathResourceFinder)voidsetWarningHandler(WarningHandler optionalWarningHandler)-
Methods inherited from class org.codehaus.janino.IClassLoader
createJavacLikePathIClassLoader, defineIClass, loadIClass, postConstruct
-
-
-
-
Constructor Detail
-
JavaSourceIClassLoader
public JavaSourceIClassLoader(ResourceFinder sourceFinder, java.lang.String optionalCharacterEncoding, java.util.Set unitCompilers, IClassLoader optionalParentIClassLoader)
Notice that theunitCompilersset is both read and written by theJavaSourceIClassLoader: As it searches forIClasses, it looks intounitCompilersfor class declarations, and as it opens, scans and parses compilation units on-the-fly, it adds them tounitCompilers.
-
-
Method Detail
-
setSourceFinder
public void setSourceFinder(ResourceFinder pathResourceFinder)
-
setCharacterEncoding
public void setCharacterEncoding(java.lang.String optionalCharacterEncoding)
-
setCompileErrorHandler
public void setCompileErrorHandler(UnitCompiler.ErrorHandler optionalCompileErrorHandler)
-
setWarningHandler
public void setWarningHandler(WarningHandler optionalWarningHandler)
-
findIClass
public IClass findIClass(java.lang.String fieldDescriptor) throws java.lang.ClassNotFoundException
Description copied from class:IClassLoaderFind a newIClassby descriptor; returnnullif a class for thatdescriptorcould not be found.Similar
ClassLoader.findClass(java.lang.String), this method must- Get an
IClassobject from somewhere for the given type - Call
IClassLoader.defineIClass(IClass)with thatIClassobject as the argument - Return the
IClassobject
The format of a
descriptoris defined in JVMS 4.3.2. Typical descriptors are:I(Integer)Lpkg1/pkg2/Cls;(Class declared in package)Lpkg1/pkg2/Outer$Inner;Member class
Notice that this method is never called from more than one thread at a time. In other words, implementations of this method need not be synchronized.
- Specified by:
findIClassin classIClassLoader- Parameters:
fieldDescriptor- Field descriptor of theIClassto load, e.g. "Lpkg1/pkg2/Outer$Inner;"- Returns:
nullif a class with that descriptor could not be found- Throws:
java.lang.ClassNotFoundException- An exception was raised while loading theIClass
- Get an
-
-