org.objectweb.fractal.julia.loader
Class DynamicLoader
java.lang.Object
org.objectweb.fractal.julia.loader.BasicLoader
org.objectweb.fractal.julia.loader.DynamicLoader
- All Implemented Interfaces:
- Loader
public class DynamicLoader
- extends BasicLoader
Provides an implementation of the Loader
interface that can
generate classes on the fly.
Requirements
- the Java platform must provide the Java reflection API and the
ClassLoader class.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DynamicLoader
public DynamicLoader()
init
public void init(Map context)
throws Exception
- Description copied from interface:
Loader
- Initializes this loader.
- Specified by:
init
in interface Loader
- Overrides:
init
in class BasicLoader
- Parameters:
context
- the initialization arguments.
- Throws:
Exception
- if the initialization fails.
loadClass
public Class loadClass(String name,
Object loader)
throws ClassNotFoundException
- Description copied from interface:
Loader
- Loads the class whose name is given.
- Specified by:
loadClass
in interface Loader
- Overrides:
loadClass
in class BasicLoader
- Parameters:
name
- the fully qualified name of the class to be returned.loader
- an optional class loader to load auxiliary classes.
- Returns:
- the class whose name is given.
- Throws:
ClassNotFoundException
- if the specified class is not found.
generateClass
protected Class generateClass(String name,
Tree classDescriptor,
Object loader)
throws ClassNotFoundException
- Description copied from class:
BasicLoader
- Generates the class whose descriptor is given, with the given name. The
generated class must implement the
Generated
interface,
and its getFcGeneratorParameters
method must return classDescriptor.toString(). The default
implementation of this method throws an exception.
- Overrides:
generateClass
in class BasicLoader
- Parameters:
name
- the name of the class to be generated.classDescriptor
- the descriptor of the class to be generated. This
descriptor must be of the form "(objectDescriptor arg1 ...
argN)" (see loadClass
).loader
- an optional class loader to load auxiliary classes.
- Returns:
- a class named name and whose content is described by the
given class descriptor.
- Throws:
ClassNotFoundException
- if a problem occurs during the generation
of the class.