public abstract class AbstractClassEnhancer extends Object implements ClassEnhancer
| Modifier and Type | Field and Description |
|---|---|
String |
className
Class name of the class being enhanced
|
protected ClassLoaderResolver |
clr
Class Loader Resolver to use for any loading issues.
|
protected ClassMetaData |
cmd
MetaData for the class being enhanced.
|
protected List<ClassField> |
fieldsToAdd
List of fields to be added to the class.
|
protected boolean |
initialised
Flag for whether we are initialised.
|
protected static Localiser |
LOCALISER |
protected MetaDataManager |
metaDataMgr
MetaData Manager to use.
|
protected List<ClassMethod> |
methodsToAdd
List of methods to be added to the class.
|
protected Collection<String> |
options
Options for enhancement.
|
protected boolean |
update
Flag specifying if the class needs updating.
|
ASM_API_VERSION, OPTION_GENERATE_DEFAULT_CONSTRUCTOR, OPTION_GENERATE_DETACH_LISTENER, OPTION_GENERATE_PK| Constructor and Description |
|---|
AbstractClassEnhancer(ClassMetaData cmd,
ClassLoaderResolver clr,
MetaDataManager mmgr)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
ClassLoaderResolver |
getClassLoaderResolver()
Accessor for the ClassLoaderResolver
|
ClassMetaData |
getClassMetaData()
Accessor for the ClassMetaData for the class.
|
String |
getClassName()
Accessor for the name of the class being enhanced.
|
List<ClassField> |
getFieldsList()
Accessor for the fields required.
|
MetaDataManager |
getMetaDataManager()
Accessor for the MetaData manager in use.
|
List<ClassMethod> |
getMethodsList()
Accessor for the methods required.
|
boolean |
hasOption(String name)
Accessor for whether a particular option is enabled.
|
protected void |
initialise()
Initialisation of the information for enhancing this class.
|
protected abstract void |
initialiseFieldsList()
Method to initialise the list of fields to add.
|
protected abstract void |
initialiseMethodsList()
Method to initialise the list of methods to add.
|
boolean |
isPersistable(String className)
Check if the class is Persistable or is going to be enhanced based on the metadata
|
protected boolean |
requiresDetachable()
Convenience method for whether this class needs to implement Detachable
|
void |
save(String directoryName)
Method to save the class definition bytecode into a class file.
|
void |
setOptions(Collection<String> options)
Method to set the options controlling the enhancement.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitenhance, getASMClassName, getClassBeingEnhanced, getClassBytes, getClassDescriptor, getNamer, getPrimaryKeyClassBytes, setNamer, validateprotected static final Localiser LOCALISER
protected final ClassLoaderResolver clr
protected final MetaDataManager metaDataMgr
protected final ClassMetaData cmd
public final String className
protected boolean update
protected List<ClassField> fieldsToAdd
protected List<ClassMethod> methodsToAdd
protected boolean initialised
protected Collection<String> options
public AbstractClassEnhancer(ClassMetaData cmd, ClassLoaderResolver clr, MetaDataManager mmgr)
cmd - MetaData for the class to be enhancedclr - ClassLoader resolvermmgr - MetaData managerprotected void initialise()
public String getClassName()
ClassEnhancergetClassName in interface ClassEnhancerprotected abstract void initialiseMethodsList()
protected abstract void initialiseFieldsList()
public List<ClassMethod> getMethodsList()
getMethodsList in interface ClassEnhancerpublic List<ClassField> getFieldsList()
getFieldsList in interface ClassEnhancerpublic ClassLoaderResolver getClassLoaderResolver()
getClassLoaderResolver in interface ClassEnhancerpublic MetaDataManager getMetaDataManager()
ClassEnhancergetMetaDataManager in interface ClassEnhancerpublic ClassMetaData getClassMetaData()
ClassEnhancergetClassMetaData in interface ClassEnhancerprotected boolean requiresDetachable()
public boolean isPersistable(String className)
isPersistable in interface ClassEnhancerclassName - the class namepublic void setOptions(Collection<String> options)
ClassEnhancersetOptions in interface ClassEnhanceroptions - The optionspublic boolean hasOption(String name)
ClassEnhancerhasOption in interface ClassEnhancername - Name of the optionpublic void save(String directoryName) throws IOException
save in interface ClassEnhancerdirectoryName - Name of a directory (or null to overwrite the class)IOException - If an I/O error occurs in the write.Copyright © 2013. All Rights Reserved.