| java.lang.Object java.lang.ClassLoader org.codehaus.janino.JavaSourceClassLoader
All known Subclasses: org.codehaus.janino.CachingJavaSourceClassLoader,
JavaSourceClassLoader | public class JavaSourceClassLoader extends ClassLoader (Code) | | A
ClassLoader that, unlike usual
ClassLoader s,
does not load byte code, but reads JavaTM source code and then scans, parses,
compiles and loads it into the virtual machine.
|
Inner Class :public interface ProtectionDomainFactory | |
Method Summary | |
protected Class | defineBytecode(String className, byte[] ba) Calls
java.lang.ClassLoader.defineClass(java.lang.Stringbyte[]intint) or
java.lang.ClassLoader.defineClass(java.lang.Stringbyte[]intintjava.security.ProtectionDomain) ,
depending on whether or not a
ProtectionDomainFactory was set. | protected Class | defineBytecodes(String name, Map bytecodes) Define a set of classes, like
java.lang.ClassLoader.defineClass(java.lang.Stringbyte[]intint) . | protected Class | findClass(String name) Implementation of
ClassLoader.findClass(String) . | protected Map | generateBytecodes(String name) Find, scan, parse the right compilation unit. | public static void | main(String[] args) Read JavaTM source code for a given class name, scan, parse, compile and load
it into the virtual machine, and invoke its "main()" method.
Usage is as follows:
java [ java-option ] org.codehaus.janino.JavaSourceClassLoader [ option ] ... | public void | setCompileErrorHandler(UnitCompiler.ErrorHandler optionalCompileErrorHandler) | public void | setProtectionDomainFactory(ProtectionDomainFactory protectionDomainFactory) | public void | setWarningHandler(WarningHandler optionalWarningHandler) |
JavaSourceClassLoader | public JavaSourceClassLoader(ClassLoader parentClassLoader, File[] optionalSourcePath, String optionalCharacterEncoding, EnumeratorSet debuggingInformation)(Code) | | Set up a
JavaSourceClassLoader that finds JavaTM source code in a file
that resides in either of the directories specified by the given source path.
Parameters: parentClassLoader - See ClassLoader Parameters: optionalSourcePath - A collection of directories that are searched for JavaTM source files in the given order Parameters: optionalCharacterEncoding - The encoding of the JavaTM source files (null for platform default encoding) Parameters: debuggingInformation - What kind of debugging information to generate |
JavaSourceClassLoader | public JavaSourceClassLoader(ClassLoader parentClassLoader, ResourceFinder sourceFinder, String optionalCharacterEncoding, EnumeratorSet debuggingInformation)(Code) | | Set up a
JavaSourceClassLoader that finds JavaTM source code through
a given
ResourceFinder .
Parameters: parentClassLoader - See ClassLoader Parameters: sourceFinder - Used to locate additional source files Parameters: optionalCharacterEncoding - The encoding of the JavaTM source files (null for platform default encoding) Parameters: debuggingInformation - What kind of debugging information to generate |
generateBytecodes | protected Map generateBytecodes(String name) throws ClassNotFoundException(Code) | | Find, scan, parse the right compilation unit. Compile the parsed compilation unit to
bytecode. This may cause more compilation units being scanned and parsed. Continue until
all compilation units are compiled.
null if no source code could be found |
main | public static void main(String[] args)(Code) | | Read JavaTM source code for a given class name, scan, parse, compile and load
it into the virtual machine, and invoke its "main()" method.
Usage is as follows:
java [ java-option ] org.codehaus.janino.JavaSourceClassLoader [ option ] ... class-name [ arg ] ...
java-option Any valid option for the Java Virtual Machine (e.g. "-classpath colon-separated-list-of-class-directories")
option:
-sourcepath colon-separated-list-of-source-directories
-encoding character-encoding
-g Generate all debugging info");
-g:none Generate no debugging info");
-g:{lines,vars,source} Generate only some debugging info");
-cache dir Cache compiled classes here");
|
setProtectionDomainFactory | public void setProtectionDomainFactory(ProtectionDomainFactory protectionDomainFactory)(Code) | | |
Methods inherited from java.lang.ClassLoader | public synchronized void clearAssertionStatus()(Code)(Java Doc) final protected Class> defineClass(byte[] b, int off, int len) throws ClassFormatError(Code)(Java Doc) final protected Class> defineClass(String name, byte[] b, int off, int len) throws ClassFormatError(Code)(Java Doc) final protected Class> defineClass(String name, byte[] b, int off, int len, ProtectionDomain protectionDomain) throws ClassFormatError(Code)(Java Doc) final protected Class> defineClass(String name, java.nio.ByteBuffer b, ProtectionDomain protectionDomain) throws ClassFormatError(Code)(Java Doc) protected Package definePackage(String name, String specTitle, String specVersion, String specVendor, String implTitle, String implVersion, String implVendor, URL sealBase) throws IllegalArgumentException(Code)(Java Doc) protected Class> findClass(String name) throws ClassNotFoundException(Code)(Java Doc) protected String findLibrary(String libname)(Code)(Java Doc) final protected Class> findLoadedClass(String name)(Code)(Java Doc) protected URL findResource(String name)(Code)(Java Doc) protected Enumeration<URL> findResources(String name) throws IOException(Code)(Java Doc) final protected Class> findSystemClass(String name) throws ClassNotFoundException(Code)(Java Doc) protected Package getPackage(String name)(Code)(Java Doc) protected Package[] getPackages()(Code)(Java Doc) final public ClassLoader getParent()(Code)(Java Doc) public URL getResource(String name)(Code)(Java Doc) public InputStream getResourceAsStream(String name)(Code)(Java Doc) public Enumeration<URL> getResources(String name) throws IOException(Code)(Java Doc) public static ClassLoader getSystemClassLoader()(Code)(Java Doc) public static URL getSystemResource(String name)(Code)(Java Doc) public static InputStream getSystemResourceAsStream(String name)(Code)(Java Doc) public static Enumeration<URL> getSystemResources(String name) throws IOException(Code)(Java Doc) public Class> loadClass(String name) throws ClassNotFoundException(Code)(Java Doc) protected synchronized Class> loadClass(String name, boolean resolve) throws ClassNotFoundException(Code)(Java Doc) final protected void resolveClass(Class> c)(Code)(Java Doc) public synchronized void setClassAssertionStatus(String className, boolean enabled)(Code)(Java Doc) public synchronized void setDefaultAssertionStatus(boolean enabled)(Code)(Java Doc) public synchronized void setPackageAssertionStatus(String packageName, boolean enabled)(Code)(Java Doc) final protected void setSigners(Class> c, Object[] signers)(Code)(Java Doc)
|
|
|