public class DynamicClassWriter extends Object implements EclipseLinkClassWriter
The intent is to provide a common writer for dynamic JPA entities but also allow for subclasses of this to be used in more complex writing situations such as SDO and DBWS.
Instances of this class and any subclasses are maintained within the
DynamicClassLoader.getClassWriters() and
DynamicClassLoader.defaultWriter for the life of the class loader so
it is important that no unnecessary state be maintained that may effect
memory usage.
| Modifier and Type | Field and Description |
|---|---|
static int[] |
ICONST |
| Constructor and Description |
|---|
DynamicClassWriter() |
DynamicClassWriter(Class<?> parentClass) |
DynamicClassWriter(String parentClassName)
Create using a loader and class name so that the parent class can be
lazily loaded when the writer is used to generate a dynamic class.
|
| Modifier and Type | Method and Description |
|---|---|
Class<?> |
getParentClass() |
String |
getParentClassName() |
boolean |
isCompatible(EclipseLinkClassWriter writer)
Verify that the provided writer is compatible with the current writer.
|
String |
toString() |
byte[] |
writeClass(DynamicClassLoader loader,
String className) |
public DynamicClassWriter()
public DynamicClassWriter(Class<?> parentClass)
public DynamicClassWriter(String parentClassName)
The loader must not be null and the parentClassName must not be null and not an empty String. The parentClassName will be converted to a class using the provided loader lazily.
public Class<?> getParentClass()
getParentClass in interface EclipseLinkClassWriterpublic String getParentClassName()
getParentClassName in interface EclipseLinkClassWriterpublic byte[] writeClass(DynamicClassLoader loader, String className) throws ClassNotFoundException
writeClass in interface EclipseLinkClassWriterClassNotFoundExceptionpublic boolean isCompatible(EclipseLinkClassWriter writer)
Used in DynamicClassLoader#addClass(String, DynamicClassWriter)
to verify if a duplicate request of the same className can proceed and
return the same class that may already exist.
isCompatible in interface EclipseLinkClassWriter