Package org.codehaus.janino
Class IClassLoader
- java.lang.Object
-
- org.codehaus.janino.IClassLoader
-
- Direct Known Subclasses:
ClassLoaderIClassLoader,JavaSourceIClassLoader,ResourceFinderIClassLoader
public abstract class IClassLoader extends java.lang.ObjectLoads anIClassby type name.
-
-
Field Summary
-
Constructor Summary
Constructors Constructor Description IClassLoader(IClassLoader optionalParentIClassLoader)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static IClassLoadercreateJavacLikePathIClassLoader(java.io.File[] optionalBootClassPath, java.io.File[] optionalExtDirs, java.io.File[] classPath)Create anIClassLoaderthat looks for classes in the given "boot class path", then in the given "extension directories", and then in the given "class path".protected voiddefineIClass(IClass iClass)Define anIClassin the context of thisIClassLoader.protected abstract IClassfindIClass(java.lang.String descriptor)IClassloadIClass(java.lang.String fieldDescriptor)Get anIClassby field descriptor.protected voidpostConstruct()This method must be called by the constructor of the directly derived class.
-
-
-
Field Detail
-
JAVA_LANG_OBJECT
public IClass JAVA_LANG_OBJECT
-
JAVA_LANG_STRING
public IClass JAVA_LANG_STRING
-
JAVA_LANG_CLASS
public IClass JAVA_LANG_CLASS
-
JAVA_LANG_THROWABLE
public IClass JAVA_LANG_THROWABLE
-
JAVA_LANG_RUNTIMEEXCEPTION
public IClass JAVA_LANG_RUNTIMEEXCEPTION
-
JAVA_LANG_ERROR
public IClass JAVA_LANG_ERROR
-
JAVA_LANG_CLONEABLE
public IClass JAVA_LANG_CLONEABLE
-
JAVA_LANG_ASSERTIONERROR
public IClass JAVA_LANG_ASSERTIONERROR
-
JAVA_LANG_OVERRIDE
public IClass JAVA_LANG_OVERRIDE
-
JAVA_IO_SERIALIZABLE
public IClass JAVA_IO_SERIALIZABLE
-
JAVA_LANG_BOOLEAN
public IClass JAVA_LANG_BOOLEAN
-
JAVA_LANG_BYTE
public IClass JAVA_LANG_BYTE
-
JAVA_LANG_CHARACTER
public IClass JAVA_LANG_CHARACTER
-
JAVA_LANG_SHORT
public IClass JAVA_LANG_SHORT
-
JAVA_LANG_INTEGER
public IClass JAVA_LANG_INTEGER
-
JAVA_LANG_LONG
public IClass JAVA_LANG_LONG
-
JAVA_LANG_FLOAT
public IClass JAVA_LANG_FLOAT
-
JAVA_LANG_DOUBLE
public IClass JAVA_LANG_DOUBLE
-
-
Constructor Detail
-
IClassLoader
public IClassLoader(IClassLoader optionalParentIClassLoader)
-
-
Method Detail
-
postConstruct
protected final void postConstruct()
This method must be called by the constructor of the directly derived class. (The reason being is that this method invokes abstractloadIClass(String)which will not work until the implementing class is constructed.)
-
loadIClass
public final IClass loadIClass(java.lang.String fieldDescriptor) throws java.lang.ClassNotFoundException
Get anIClassby field descriptor.
-
findIClass
protected abstract IClass findIClass(java.lang.String descriptor) throws java.lang.ClassNotFoundException
Find 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
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.
- Returns:
nullif a class with that descriptor could not be found- Throws:
java.lang.ClassNotFoundException- if an exception was raised while loading the class
- Get an
-
defineIClass
protected final void defineIClass(IClass iClass)
Define anIClassin the context of thisIClassLoader. If anIClasswith that descriptor already exists, aRuntimeExceptionis thrown.This method should only be called from an implementation of
findIClass(String).- Throws:
java.lang.RuntimeException- A differentIClassobject is already defined for this type
-
createJavacLikePathIClassLoader
public static IClassLoader createJavacLikePathIClassLoader(java.io.File[] optionalBootClassPath, java.io.File[] optionalExtDirs, java.io.File[] classPath)
Create anIClassLoaderthat looks for classes in the given "boot class path", then in the given "extension directories", and then in the given "class path".The default for the
optionalBootClassPathis the path defined in the system property "sun.boot.class.path", and the default for theoptionalExtensionDirsis the path defined in the "java.ext.dirs" system property.
-
-