org.codehaus.janino
Class JavaSourceIClassLoader

java.lang.Object
  extended by org.codehaus.janino.IClassLoader
      extended by org.codehaus.janino.JavaSourceIClassLoader

public final class JavaSourceIClassLoader
extends IClassLoader

This IClassLoader finds, scans and parses compilation units.

Notice that it does not compile them!


Field Summary
 
Fields inherited from class org.codehaus.janino.IClassLoader
BOOLEAN, BYTE, CHARACTER, CLASS, CLONEABLE, DOUBLE, ERROR, FLOAT, INTEGER, LONG, OBJECT, RUNTIME_EXCEPTION, SERIALIZABLE, SHORT, STRING, THROWABLE
 
Constructor Summary
JavaSourceIClassLoader(ResourceFinder sourceFinder, java.lang.String optionalCharacterEncoding, java.util.Set unitCompilers, IClassLoader optionalParentIClassLoader)
          Notice that the unitCompilers set is both read and written by the JavaSourceIClassLoader: As it searches for IClasses, it looks into unitCompilers for class declarations, and as it opens, scans and parses compilation units on-the-fly, it adds them to unitCompilers.
 
Method Summary
 IClass findIClass(java.lang.String type)
          Find a new IClass by descriptor; return null if a class for that descriptor could not be found.
 void setCharacterEncoding(java.lang.String optionalCharacterEncoding)
           
 void setCompileErrorHandler(UnitCompiler.ErrorHandler optionalCompileErrorHandler)
           
 void setSourceFinder(ResourceFinder pathResourceFinder)
           
 void setWarningHandler(WarningHandler optionalWarningHandler)
           
 
Methods inherited from class org.codehaus.janino.IClassLoader
createJavacLikePathIClassLoader, defineIClass, loadIClass, postConstruct
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JavaSourceIClassLoader

public JavaSourceIClassLoader(ResourceFinder sourceFinder,
                              java.lang.String optionalCharacterEncoding,
                              java.util.Set unitCompilers,
                              IClassLoader optionalParentIClassLoader)
Notice that the unitCompilers set is both read and written by the JavaSourceIClassLoader: As it searches for IClasses, it looks into unitCompilers for class declarations, and as it opens, scans and parses compilation units on-the-fly, it adds them to unitCompilers.

Method Detail

setSourceFinder

public void setSourceFinder(ResourceFinder pathResourceFinder)

setCharacterEncoding

public void setCharacterEncoding(java.lang.String optionalCharacterEncoding)

setCompileErrorHandler

public void setCompileErrorHandler(UnitCompiler.ErrorHandler optionalCompileErrorHandler)
See Also:
UnitCompiler.setCompileErrorHandler(ErrorHandler)

setWarningHandler

public void setWarningHandler(WarningHandler optionalWarningHandler)
See Also:
Parser.setWarningHandler(WarningHandler), UnitCompiler.setCompileErrorHandler(ErrorHandler)

findIClass

public IClass findIClass(java.lang.String type)
                  throws java.lang.ClassNotFoundException
Description copied from class: IClassLoader
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.

Specified by:
findIClass in class IClassLoader
Parameters:
type - field descriptor of the IClass to load, e.g. "Lpkg1/pkg2/Outer$Inner;"
Returns:
null if a class with that descriptor could not be found
Throws:
java.lang.ClassNotFoundException - if an exception was raised while loading the IClass


Copyright © 2001-2012. All Rights Reserved.