public class JDOClassEnhancer extends AbstractClassEnhancer
Modifier and Type | Class and Description |
---|---|
static class |
JDOClassEnhancer.MyClassVisitor
Convenience class to look up the class name for a file.
|
Modifier and Type | Field and Description |
---|---|
protected String |
asmClassName
ASM Class name for this class (replace .
|
protected byte[] |
classBytes
Bytes of the class (after enhancing).
|
protected String |
classDescriptor
Class descriptor for this class.
|
protected Class |
cls
Class that is being enhanced.
|
protected byte[] |
inputBytes
Bytes of the input class (only when enhancing generated classes with no class file).
|
protected String |
inputResourceName
Resource name of the input class (only when the class exists in a class file).
|
protected EnhancementNamer |
namer |
protected byte[] |
pkClassBytes
Bytes for any auto-generated PK class (if generated during enhancement).
|
className, clr, cmd, fieldsToAdd, initialised, LOCALISER, metaDataMgr, methodsToAdd, options, update
ASM_API_VERSION, OPTION_GENERATE_DEFAULT_CONSTRUCTOR, OPTION_GENERATE_DETACH_LISTENER, OPTION_GENERATE_PK
Constructor and Description |
---|
JDOClassEnhancer(ClassMetaData cmd,
ClassLoaderResolver clr,
MetaDataManager mmgr)
Constructor for an enhancer for the class.
|
JDOClassEnhancer(ClassMetaData cmd,
ClassLoaderResolver clr,
MetaDataManager mmgr,
byte[] classBytes)
Constructor for an enhancer to enhance a class defined by the provided bytes.
|
Modifier and Type | Method and Description |
---|---|
protected boolean |
checkClassIsEnhanced(boolean logErrors)
Convenience method to return if a class is enhanced.
|
boolean |
enhance()
Method to enhance a classes definition.
|
String |
getASMClassName()
Accessor for the ASM class name
|
Class |
getClassBeingEnhanced()
Accessor for the class being enhanced.
|
byte[] |
getClassBytes()
Accessor for the class bytes.
|
String |
getClassDescriptor()
Accessor for the class descriptor for the class being enhanced
|
static String |
getClassNameForFileName(String filename)
Convenience accessor for the class name that is stored in a particular class.
|
EnhancementNamer |
getNamer() |
byte[] |
getPrimaryKeyClassBytes()
Accessor for the primary-key class bytes (if generating a PK).
|
protected void |
initialiseFieldsList()
Method to initialise the list of fields to add.
|
protected void |
initialiseMethodsList()
Method to initialise the list of methods to add.
|
void |
setNamer(EnhancementNamer namer) |
boolean |
validate()
Validate whether the class is enhanced.
|
getClassLoaderResolver, getClassMetaData, getClassName, getFieldsList, getMetaDataManager, getMethodsList, hasOption, initialise, isPersistable, requiresDetachable, save, setOptions
protected String inputResourceName
protected byte[] inputBytes
protected final Class cls
protected byte[] classBytes
protected byte[] pkClassBytes
protected String asmClassName
protected String classDescriptor
protected EnhancementNamer namer
public JDOClassEnhancer(ClassMetaData cmd, ClassLoaderResolver clr, MetaDataManager mmgr)
cmd
- MetaData for the class to be enhancedclr
- ClassLoader resolvermmgr
- MetaData managerpublic JDOClassEnhancer(ClassMetaData cmd, ClassLoaderResolver clr, MetaDataManager mmgr, byte[] classBytes)
cmd
- MetaData for the class to be enhancedclr
- ClassLoader resolvermmgr
- MetaData managerclassBytes
- Bytes of the class to enhancepublic void setNamer(EnhancementNamer namer)
public static String getClassNameForFileName(String filename)
filename
- Name of the filepublic Class getClassBeingEnhanced()
public String getASMClassName()
public String getClassDescriptor()
protected void initialiseMethodsList()
initialiseMethodsList
in class AbstractClassEnhancer
protected void initialiseFieldsList()
initialiseFieldsList
in class AbstractClassEnhancer
public boolean enhance()
public byte[] getClassBytes()
public byte[] getPrimaryKeyClassBytes()
public boolean validate()
ClassEnhancer
protected boolean checkClassIsEnhanced(boolean logErrors)
logErrors
- Whether to log any errors (missing methods etc) as errors (otherwise info/debug)public EnhancementNamer getNamer()
Copyright © 2021. All rights reserved.