janino.net

org.codehaus.janino
Class IClassLoader

java.lang.Object
  extended by org.codehaus.janino.IClassLoader
Direct Known Subclasses:
ClassLoaderIClassLoader, JavaSourceIClassLoader, ResourceFinderIClassLoader

public abstract class IClassLoader
extends Object

Loads an IClass by type name.


Field Summary
 IClass ANNO_java_lang_Override
          Representation of the Override annotation.
 IClass.IConstructor CTOR_java_lang_StringBuilder__java_lang_String
          Representation of the StringBuilder.StringBuilder(String) constructor.
 IClass.IMethod METH_java_lang_Iterable__iterator
          Representation of the Iterable.iterator() method.
 IClass.IMethod METH_java_lang_String__concat__java_lang_String
          Representation of the String.concat(String) method.
 IClass.IMethod METH_java_lang_String__valueOf__boolean
          Representation of the String.valueOf(boolean) method.
 IClass.IMethod METH_java_lang_String__valueOf__char
          Representation of the String.valueOf(char) method.
 IClass.IMethod METH_java_lang_String__valueOf__double
          Representation of the String.valueOf(double) method.
 IClass.IMethod METH_java_lang_String__valueOf__float
          Representation of the String.valueOf(float) method.
 IClass.IMethod METH_java_lang_String__valueOf__int
          Representation of the String.valueOf(int) method.
 IClass.IMethod METH_java_lang_String__valueOf__java_lang_Object
          Representation of the String.valueOf(Object) method.
 IClass.IMethod METH_java_lang_String__valueOf__long
          Representation of the String.valueOf(long) method.
 IClass.IMethod METH_java_lang_StringBuilder__append__java_lang_String
          Representation of the StringBuilder.append(String) method.
 IClass.IMethod METH_java_lang_StringBuilder__toString
          Representation of the StringBuilder.toString() method.
 IClass.IMethod METH_java_util_Iterator__hasNext
          Representation of the Iterator.hasNext() method.
 IClass.IMethod METH_java_util_Iterator__next
          Representation of the Iterator.next() method.
 IClass TYPE_java_io_Serializable
          Representation of the Serializable type.
 IClass TYPE_java_lang_AssertionError
          Representation of the AssertionError type.
 IClass TYPE_java_lang_Boolean
          Representation of the Boolean type.
 IClass TYPE_java_lang_Byte
          Representation of the Byte type.
 IClass TYPE_java_lang_Character
          Representation of the Character type.
 IClass TYPE_java_lang_Class
          Representation of the Class type.
 IClass TYPE_java_lang_Cloneable
          Representation of the Cloneable type.
 IClass TYPE_java_lang_Double
          Representation of the Double type.
 IClass TYPE_java_lang_Error
          Representation of the Error type.
 IClass TYPE_java_lang_Exception
          Representation of the Exception type.
 IClass TYPE_java_lang_Float
          Representation of the Float type.
 IClass TYPE_java_lang_Integer
          Representation of the Integer type.
 IClass TYPE_java_lang_Iterable
          Representation of the Iterable type.
 IClass TYPE_java_lang_Long
          Representation of the Long type.
 IClass TYPE_java_lang_Object
          Representation of the Object type.
 IClass TYPE_java_lang_RuntimeException
          Representation of the RuntimeException type.
 IClass TYPE_java_lang_Short
          Representation of the Short type.
 IClass TYPE_java_lang_String
          Representation of the String type.
 IClass TYPE_java_lang_StringBuilder
          Representation of the StringBuilder type.
 IClass TYPE_java_lang_Throwable
          Representation of the Throwable type.
 IClass TYPE_java_util_Iterator
          Representation of the Iterator type.
 
Constructor Summary
IClassLoader(IClassLoader optionalParentIClassLoader)
           
 
Method Summary
static IClassLoader createJavacLikePathIClassLoader(File[] optionalBootClassPath, File[] optionalExtDirs, File[] classPath)
          Create an IClassLoader that looks for classes in the given "boot class path", then in the given "extension directories", and then in the given "class path".
protected  void defineIClass(IClass iClass)
          Define an IClass in the context of this IClassLoader.
protected abstract  IClass findIClass(String descriptor)
          Find a new IClass by descriptor; return null if a class for that descriptor could not be found.
 IClass loadIClass(String fieldDescriptor)
          Get an IClass by field descriptor.
protected  void postConstruct()
          This method must be called by the constructor of the directly derived class.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ANNO_java_lang_Override

public IClass ANNO_java_lang_Override
Representation of the Override annotation.


TYPE_java_lang_AssertionError

public IClass TYPE_java_lang_AssertionError
Representation of the AssertionError type.


TYPE_java_lang_Boolean

public IClass TYPE_java_lang_Boolean
Representation of the Boolean type.


TYPE_java_lang_Byte

public IClass TYPE_java_lang_Byte
Representation of the Byte type.


TYPE_java_lang_Character

public IClass TYPE_java_lang_Character
Representation of the Character type.


TYPE_java_lang_Class

public IClass TYPE_java_lang_Class
Representation of the Class type.


TYPE_java_lang_Cloneable

public IClass TYPE_java_lang_Cloneable
Representation of the Cloneable type.


TYPE_java_lang_Double

public IClass TYPE_java_lang_Double
Representation of the Double type.


TYPE_java_lang_Exception

public IClass TYPE_java_lang_Exception
Representation of the Exception type.


TYPE_java_lang_Error

public IClass TYPE_java_lang_Error
Representation of the Error type.


TYPE_java_lang_Float

public IClass TYPE_java_lang_Float
Representation of the Float type.


TYPE_java_lang_Integer

public IClass TYPE_java_lang_Integer
Representation of the Integer type.


TYPE_java_lang_Iterable

public IClass TYPE_java_lang_Iterable
Representation of the Iterable type.


TYPE_java_lang_Long

public IClass TYPE_java_lang_Long
Representation of the Long type.


TYPE_java_lang_Object

public IClass TYPE_java_lang_Object
Representation of the Object type.


TYPE_java_lang_RuntimeException

public IClass TYPE_java_lang_RuntimeException
Representation of the RuntimeException type.


TYPE_java_lang_Short

public IClass TYPE_java_lang_Short
Representation of the Short type.


TYPE_java_lang_String

public IClass TYPE_java_lang_String
Representation of the String type.


TYPE_java_lang_StringBuilder

public IClass TYPE_java_lang_StringBuilder
Representation of the StringBuilder type.


TYPE_java_lang_Throwable

public IClass TYPE_java_lang_Throwable
Representation of the Throwable type.


TYPE_java_io_Serializable

public IClass TYPE_java_io_Serializable
Representation of the Serializable type.


TYPE_java_util_Iterator

public IClass TYPE_java_util_Iterator
Representation of the Iterator type.


METH_java_lang_Iterable__iterator

public IClass.IMethod METH_java_lang_Iterable__iterator
Representation of the Iterable.iterator() method.


METH_java_lang_String__concat__java_lang_String

public IClass.IMethod METH_java_lang_String__concat__java_lang_String
Representation of the String.concat(String) method.


METH_java_lang_String__valueOf__int

public IClass.IMethod METH_java_lang_String__valueOf__int
Representation of the String.valueOf(int) method.


METH_java_lang_String__valueOf__long

public IClass.IMethod METH_java_lang_String__valueOf__long
Representation of the String.valueOf(long) method.


METH_java_lang_String__valueOf__float

public IClass.IMethod METH_java_lang_String__valueOf__float
Representation of the String.valueOf(float) method.


METH_java_lang_String__valueOf__double

public IClass.IMethod METH_java_lang_String__valueOf__double
Representation of the String.valueOf(double) method.


METH_java_lang_String__valueOf__char

public IClass.IMethod METH_java_lang_String__valueOf__char
Representation of the String.valueOf(char) method.


METH_java_lang_String__valueOf__boolean

public IClass.IMethod METH_java_lang_String__valueOf__boolean
Representation of the String.valueOf(boolean) method.


METH_java_lang_String__valueOf__java_lang_Object

public IClass.IMethod METH_java_lang_String__valueOf__java_lang_Object
Representation of the String.valueOf(Object) method.


METH_java_lang_StringBuilder__append__java_lang_String

public IClass.IMethod METH_java_lang_StringBuilder__append__java_lang_String
Representation of the StringBuilder.append(String) method.


METH_java_lang_StringBuilder__toString

public IClass.IMethod METH_java_lang_StringBuilder__toString
Representation of the StringBuilder.toString() method.


METH_java_util_Iterator__hasNext

public IClass.IMethod METH_java_util_Iterator__hasNext
Representation of the Iterator.hasNext() method.


METH_java_util_Iterator__next

public IClass.IMethod METH_java_util_Iterator__next
Representation of the Iterator.next() method.


CTOR_java_lang_StringBuilder__java_lang_String

public IClass.IConstructor CTOR_java_lang_StringBuilder__java_lang_String
Representation of the StringBuilder.StringBuilder(String) constructor.

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 abstract loadIClass(String) which will not work until the implementing class is constructed.)


loadIClass

public final IClass loadIClass(String fieldDescriptor)
                        throws ClassNotFoundException
Get an IClass by field descriptor.

Parameters:
fieldDescriptor - E.g. 'Lpkg1/pkg2/Outer$Inner;'
Returns:
null if an IClass could not be loaded
Throws:
ClassNotFoundException - An exception was raised while loading the IClass

findIClass

protected abstract IClass findIClass(String descriptor)
                              throws ClassNotFoundException
Find a new IClass by descriptor; return null if a class for that descriptor could not be found.

Similar ClassLoader.findClass(java.lang.String), this method must

The format of a descriptor is defined in JVMS 4.3.2. Typical descriptors are:

Notice that this method is never called for array types.

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:
null if a class with that descriptor could not be found
Throws:
ClassNotFoundException - if an exception was raised while loading the class

defineIClass

protected final void defineIClass(IClass iClass)
Define an IClass in the context of this IClassLoader. If an IClass with that descriptor already exists, a RuntimeException is thrown.

This method should only be called from an implementation of findIClass(String).

Throws:
RuntimeException - A different IClass object is already defined for this type

createJavacLikePathIClassLoader

public static IClassLoader createJavacLikePathIClassLoader(File[] optionalBootClassPath,
                                                           File[] optionalExtDirs,
                                                           File[] classPath)
Create an IClassLoader that 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 optionalBootClassPath is the path defined in the system property "sun.boot.class.path", and the default for the optionalExtensionDirs is the path defined in the "java.ext.dirs" system property.


janino.net