public class DynamicClassLoader extends ClassLoader
DynamicClassWriter
. A DynamicClassLoader requires a parent or
delegate class-loader which is provided to the constructor. This delegate
class loader handles the lookup and storage of all created classes.Modifier and Type | Class and Description |
---|---|
static class |
DynamicClassLoader.EnumInfo |
Modifier and Type | Field and Description |
---|---|
DynamicClassWriter |
defaultWriter
Default writer to use if one is not specified.
|
Constructor and Description |
---|
DynamicClassLoader(ClassLoader delegate)
Create a DynamicClassLoader providing the delegate loader and leaving the
defaultWriter as
DynamicClassWriter |
DynamicClassLoader(ClassLoader delegate,
DynamicClassWriter writer)
Create a DynamicClassLoader providing the delegate loader and a default
DynamicClassWriter . |
Modifier and Type | Method and Description |
---|---|
void |
addClass(String className)
Register a class to be dynamically created using the default
DynamicClassWriter . |
void |
addClass(String className,
Class<?> parentClass)
Register a class to be dynamically created using a copy of default
DynamicClassWriter but specifying a different parent class. |
void |
addClass(String className,
EclipseLinkClassWriter writer)
Register a class to be dynamically created using the provided
DynamicClassWriter . |
void |
addEnum(String className,
Object... literalLabels) |
Class<?> |
createDynamicClass(String className)
Create a new dynamic entity type for the specified name assuming the use
of the default writer and its default parent class.
|
Class<?> |
createDynamicClass(String className,
Class<?> parentClass)
Create a new dynamic entity type for the specified name with the
specified parent class.
|
Class<?> |
createDynamicClass(String className,
DynamicClassWriter writer)
Create a dynamic class registering a writer and then forcing the provided
class name to be loaded.
|
EclipseLinkClassWriter |
getClassWriter(String className) |
DynamicClassWriter |
getDefaultWriter() |
static DynamicClassLoader |
lookup(Session session)
Lookup the DynamicConversionManager for the given session.
|
clearAssertionStatus, getParent, getResource, getResourceAsStream, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, loadClass, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus
public DynamicClassWriter defaultWriter
public DynamicClassLoader(ClassLoader delegate)
DynamicClassWriter
public DynamicClassLoader(ClassLoader delegate, DynamicClassWriter writer)
DynamicClassWriter
.public DynamicClassWriter getDefaultWriter()
public EclipseLinkClassWriter getClassWriter(String className)
public void addClass(String className)
DynamicClassWriter
.#addClass(String, DynamicClassWriter)
public void addClass(String className, Class<?> parentClass)
DynamicClassWriter
but specifying a different parent class.#addClass(String, DynamicClassWriter)
public void addClass(String className, EclipseLinkClassWriter writer) throws DynamicException
DynamicClassWriter
. The registered writer is used when the
findClass(String)
method is called back on this loader from the
ClassLoader.loadClass(String)
call.
If a duplicate request is made for the same className and the writers are
not compatible a DynamicException
will be thrown. If the
duplicate request contains a compatible writer then the second request is
ignored as the class may already have been generated.
DynamicException
findClass(String)
public Class<?> createDynamicClass(String className, DynamicClassWriter writer)
public Class<?> createDynamicClass(String className)
#creatDynamicClass(String, DynamicClassWriter)
public Class<?> createDynamicClass(String className, Class<?> parentClass)
#creatDynamicClass(String, DynamicClassWriter)
public static DynamicClassLoader lookup(Session session)
session
-