|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.lang.ClassLoader
java.security.SecureClassLoader
koala.dynamicjava.interpreter.TreeClassLoader
This class is responsible for loading bytecode classes
All classes created by TreeClassLoader
s
have an identical
CodeSource
. This code source has no certificates
but may have a location. The latter is set to the value of the system
property with the value of CODE_SOURCE_URL_PROPERTY
as key, if
it is a valid URL. If the property is defined but its value is not a valid
URL, the location of the code source is set to null
. If the
property is not defined, the value of DEFAULT_CODE_SOURCE_URL
is
used as location.
Field Summary | |
protected java.util.Map |
classes
The place where the interpreted classes are stored |
protected java.lang.ClassLoader |
classLoader
The auxiliary class loader |
static java.lang.String |
CODE_SOURCE_URL_PROPERTY
Name of the system property to define the value for the URL of the CodeSource assigned to classes
created by this classloader. |
protected static java.security.CodeSource |
codeSource
The code source for classes defined by instances of TreeClassLoader . |
static java.lang.String |
DEFAULT_CODE_SOURCE_URL
The default value for the CodeSource URL. |
protected Interpreter |
interpreter
The interpreter |
protected java.util.Map |
trees
The syntax trees |
Constructor Summary | |
TreeClassLoader(Interpreter i)
Creates a new class loader |
|
TreeClassLoader(Interpreter i,
java.lang.ClassLoader cl)
Creates a new class loader |
Method Summary | |
void |
addTree(java.lang.String name,
TypeDeclaration node)
Adds a class syntax tree to the list of the loaded trees |
void |
addURL(java.net.URL url)
Adds an URL in the class path |
java.lang.Class |
defineClass(java.lang.String name,
byte[] code)
Converts an array of bytes into an instance of class Class and links this class. |
protected java.lang.Class |
findClass(java.lang.String name)
Finds the specified class. |
java.lang.ClassLoader |
getClassLoader()
Returns the additional class loader that is used for loading classes from the net. |
java.util.Set |
getClassNames()
Returns the names of the defined classes in a set |
TypeDeclaration |
getTree(java.lang.String name)
Gets a tree |
boolean |
hasDefined(java.lang.String name)
Whether a class was defined by this class loader |
Methods inherited from class java.security.SecureClassLoader |
defineClass, getPermissions |
Methods inherited from class java.lang.ClassLoader |
clearAssertionStatus, defineClass, defineClass, defineClass, definePackage, findLibrary, findLoadedClass, findResource, findResources, findSystemClass, getPackage, getPackages, getParent, getResource, getResourceAsStream, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, loadClass, loadClass, resolveClass, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static java.lang.String DEFAULT_CODE_SOURCE_URL
CodeSource
URL.
May be overriden by setting the system property with name given by
the value of CODE_SOURCE_URL_PROPERTY
.
public static java.lang.String CODE_SOURCE_URL_PROPERTY
CodeSource
assigned to classes
created by this classloader. The default value is the value of
DEFAULT_CODE_SOURCE_URL
.
If the property value is not a wellformed URL, the URL is set
to null
.
protected static java.security.CodeSource codeSource
TreeClassLoader
. Initializes when TreeClassLoader
is loaded the first time.
DEFAULT_CODE_SOURCE_URL
,
CODE_SOURCE_URL_PROPERTY
protected java.util.Map classes
protected java.util.Map trees
protected Interpreter interpreter
protected java.lang.ClassLoader classLoader
Constructor Detail |
public TreeClassLoader(Interpreter i)
i
- the object used to interpret the classespublic TreeClassLoader(Interpreter i, java.lang.ClassLoader cl)
i
- the object used to interpret the classescl
- the auxiliary class loader used to load external classesMethod Detail |
public java.lang.Class defineClass(java.lang.String name, byte[] code)
java.lang.ClassFormatError
- if the class could not be definedpublic java.lang.ClassLoader getClassLoader()
getClassLoader
in interface ClassLoaderContainer
public boolean hasDefined(java.lang.String name)
public java.util.Set getClassNames()
public void addTree(java.lang.String name, TypeDeclaration node)
name
- the name of the typenode
- the treepublic TypeDeclaration getTree(java.lang.String name)
public void addURL(java.net.URL url)
protected java.lang.Class findClass(java.lang.String name) throws java.lang.ClassNotFoundException
name
- the name of the class
Class
object
java.lang.ClassNotFoundException
- if the class could not be find
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |