|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.datanucleus.enhancer.AbstractClassEnhancer
org.datanucleus.enhancer.asm.ASMClassEnhancer
public class ASMClassEnhancer
Class enhancer using ASM (http://asm.objectweb.org). Assumes that the version of ASM is 3.0 or above. ASM operates using a SAXParser-like "visitor-pattern". We utilise this as follows :-
| Nested Class Summary | |
|---|---|
static class |
ASMClassEnhancer.MyClassVisitor
Convenience class to look up the class name for a file. |
| Fields inherited from class org.datanucleus.enhancer.AbstractClassEnhancer |
|---|
className, clr, cmd, fieldsToAdd, initialised, LOCALISER, metaDataMgr, methodsToAdd, options, update |
| Fields inherited from interface org.datanucleus.enhancer.ClassEnhancer |
|---|
OPTION_GENERATE_DEFAULT_CONSTRUCTOR, OPTION_GENERATE_DETACH_LISTENER, OPTION_GENERATE_PK |
| Constructor Summary | |
|---|---|
ASMClassEnhancer(org.datanucleus.metadata.ClassMetaData cmd,
org.datanucleus.ClassLoaderResolver clr,
org.datanucleus.metadata.MetaDataManager mmgr)
Constructor for an enhancer for the class. |
|
ASMClassEnhancer(org.datanucleus.metadata.ClassMetaData cmd,
org.datanucleus.ClassLoaderResolver clr,
org.datanucleus.metadata.MetaDataManager mmgr,
byte[] classBytes)
Constructor for an enhancer to enhance a class defined by the provided bytes. |
|
| Method Summary | |
|---|---|
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 |
String |
getByteIdentityDescriptor()
Descriptor for ByteIdentity. |
String |
getCharIdentityDescriptor()
Descriptor for CharIdentity. |
byte[] |
getClassBytes()
Accessor for the class bytes. |
String |
getClassDescriptor()
Accessor for the class descriptor for the class being enhanced |
Class |
getClassEnhanced()
Accessor for the class being enhanced. |
static String |
getClassNameForFileName(String filename)
Convenience accessor for the class name that is stored in a particular class. |
String |
getCopyFieldMethodName()
Method name of CopyField |
String |
getCopyFieldsMethodName()
Method name of CopyFields |
String |
getCopyKeyFieldsFromObjectIdMethodName()
Method name of CopyFieldsFromObjectId |
String |
getCopyKeyFieldsToObjectIdMethodName()
Method name of CopyFieldsToObjectId |
String |
getDetachableAsmClassName()
ASM class name for Detachable. |
Class |
getDetachableClass()
Class for the Detachable interface. |
String |
getDetachableDescriptor()
Descriptor for javax.jdo.spi.Detachable. |
String |
getDetachedFieldAccessExceptionAsmClassName()
ASM class name for DetachedFieldAccessException. |
String |
getDetachedFieldAccessExceptionClassName()
Class name of DetachedFieldAccessException |
String |
getDetachedStateFieldName()
Field name of DetachedState |
String |
getFatalInternalExceptionAsmClassName()
ASM class name for FatalInternalException. |
String |
getFatalInternalExceptionClassName()
Class name of FatalInternalException |
String |
getFieldFlagsFieldName()
Field name of FieldFlags |
String |
getFieldFlagsInitMethodName()
Method name for initialising FieldFlags |
String |
getFieldNamesFieldName()
Field name of FieldNames |
String |
getFieldNamesInitMethodName()
Method name for initialising FieldNames |
String |
getFieldTypesFieldName()
Field name of FieldTypes |
String |
getFieldTypesInitMethodName()
Method name for initialising FieldTypes |
String |
getFlagsFieldName()
Field name of Flags |
String |
getGetInheritedFieldCountMethodName()
Method name for GetInheritedFieldCount |
String |
getGetManagedFieldCountMethodName()
Method name for GetManagedFieldCount |
String |
getGetMethodPrefixMethodName()
Prefix for method names for getXXX. |
String |
getGetObjectIdMethodName()
Method name for object id accessor |
String |
getGetPersistenceManagerMethodName()
Method name of GetPersistenceManager |
String |
getGetTransactionalObjectIdMethodName()
Method name for transactional object id accessor |
String |
getGetVersionMethodName()
Method name for version accessor |
String |
getHelperAsmClassName()
ASM class name for Helper. |
String |
getHelperClassName()
Class name of Helper |
String |
getImplHelperAsmClassName()
ASM class name for ImplHelper. |
String |
getImplHelperClassName()
Class name of ImplHelper |
String |
getInheritedFieldCountFieldName()
Field name of FieldCount |
String |
getIntIdentityDescriptor()
Descriptor for IntIdentity. |
String |
getIsDeletedMethodName()
Method name of IsDeleted |
String |
getIsDetachedInternalMethodName()
Method name of IsDetachedInternal |
String |
getIsDetachedMethodName()
Method name of IsDetached |
String |
getIsDirtyMethodName()
Method name of IsDirty |
String |
getIsNewMethodName()
Method name of IsNew |
String |
getIsPersistentMethodName()
Method name of IsPersistent |
String |
getIsTransactionalMethodName()
Method name of IsTransactional |
String |
getLoadClassMethodName()
Method name of LoadClass |
String |
getLongIdentityDescriptor()
Descriptor for LongIdentity. |
String |
getMakeDirtyDetachedMethodName()
Method name of MakeDirtyDetached. |
String |
getMakeDirtyMethodName()
Method name of MakeDirty. |
String |
getNewInstanceMethodName()
Method name of NewInstance. |
String |
getNewObjectIdInstanceMethodName()
Method name of NewObjectIdInstance. |
Class |
getObjectIdentityClass()
Class for ObjectIdentity. |
String |
getObjectIdentityDescriptor()
Descriptor for ObjectIdentity. |
String |
getObjectIdFieldConsumerAsmClassName()
ASM class name for ObjectIdFieldConsumer. |
Class |
getObjectIdFieldConsumerClass()
Class for ObjectIdFieldConsumer. |
String |
getObjectIdFieldConsumerDescriptor()
Descriptor for ObjectIdFieldConsumer. |
String |
getObjectIdFieldSupplierAsmClassName()
ASM class name for ObjectIdFieldSupplier. |
Class |
getObjectIdFieldSupplierClass()
Class for ObjectIdFieldSupplier. |
String |
getObjectIdFieldSupplierDescriptor()
Descriptor for ObjectIdFieldSupplier. |
String |
getPersistableAsmClassName()
ASM class name for Persistable. |
Class |
getPersistableClass()
Class for the Persistable interface. |
String |
getPersistableDescriptor()
Descriptor for javax.jdo.spi.PersistenceCapable. |
String |
getPersistableSuperclassFieldName()
Field name of PersistenceCapableSuperclass |
String |
getPersistableSuperclassInitMethodName()
Method name for PersistableSuperclassInit |
String |
getPersistenceManagerAsmClassName()
ASM class name for PersistenceManager. |
Class |
getPersistenceManagerClass()
Class for the PersistenceManager interface. |
String |
getPersistenceManagerDescriptor()
Descriptor for javax.jdo.PersistenceManager. |
String |
getPreSerializeMethodName()
Method name of PreSerialize |
byte[] |
getPrimaryKeyClassBytes()
Accessor for the primary-key class bytes (if generating a PK). |
String |
getProvideFieldMethodName()
Method name of ProvideField |
String |
getProvideFieldsMethodName()
Method name of ProvideFields |
String |
getReplaceDetachedStateMethodName()
Method name of ReplaceDetachedState. |
String |
getReplaceFieldMethodName()
Method name of ReplaceField |
String |
getReplaceFieldsMethodName()
Method name of ReplaceFields. |
String |
getReplaceFlagsMethodName()
Method name of ReplaceFlags. |
String |
getReplaceStateManagerMethodName()
Method name of ReplaceStateManager. |
String |
getSerialVersionUidFieldName()
Field name of serialVersionUID |
String |
getSetMethodPrefixMethodName()
Prefix for method names for setXXX. |
String |
getShortIdentityDescriptor()
Descriptor for ShortIdentity. |
String |
getSingleFieldIdentityDescriptor(String oidClassName)
Accessor for the descriptor for a SingleFieldIdentity type. |
String |
getStateManagerAsmClassName()
ASM class name for StateManager. |
Class |
getStateManagerClass()
Class for the StateManager interface. |
String |
getStateManagerDescriptor()
Descriptor for javax.jdo.spi.StateManager. |
String |
getStateManagerFieldName()
Field name of StateManager |
String |
getStringIdentityDescriptor()
Descriptor for StringIdentity. |
String |
getSuperCloneMethodName()
Method name for SuperClone |
String |
getTypeDescriptorForSingleFieldIdentityGetKey(String oidClassName)
Method to return the type descriptor for the key of the provided single-field identity class name. |
String |
getTypeNameForUseWithSingleFieldIdentity(String oidClassName)
Convenience method to give the method type name for a singleFieldIdentity class name. |
protected void |
initialiseFieldsList()
Method to initialise the list of fields to add. |
protected void |
initialiseMethodsList()
Method to initialise the list of methods to add. |
static boolean |
useFrames()
|
boolean |
validate()
Validate whether the class is enhanced. |
| Methods inherited from class org.datanucleus.enhancer.AbstractClassEnhancer |
|---|
getClassLoaderResolver, getClassMetaData, getFieldsList, getMetaDataManager, getMethodsList, hasOption, initialise, isPersistenceCapable, requiresDetachable, save, setOptions |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static final org.datanucleus.util.Localiser LOCALISER_CORE
public static final int ASM_API_VERSION
public static final String FN_StateManager
public static final String FN_Flag
public static final String FN_FieldNames
public static final String FN_FieldTypes
public static final String FN_FieldFlags
public static final String FN_PersistableSuperclass
public static final String FN_InheritedFieldCount
public static final String FN_DetachedState
public static final String FN_SerialVersionUID
public static final String MN_GetterPrefix
public static final String MN_SetterPrefix
public static final String MN_FieldNamesInitMethod
public static final String MN_FieldTypesInitMethod
public static final String MN_FieldFlagsInitMethod
public static final String MN_GetObjectId
public static final String MN_GetTransactionalObjectId
public static final String MN_GetVersion
public static final String MN_IsDetached
public static final String MN_IsDetachedInternal
public static final String MN_IsDeleted
public static final String MN_IsDirty
public static final String MN_IsNew
public static final String MN_IsPersistent
public static final String MN_IsTransactional
public static final String MN_GetPersistenceManager
public static final String MN_PreSerialize
public static final String MN_GetInheritedFieldCount
public static final String MN_SuperClone
public static final String MN_GetManagedFieldCount
public static final String MN_PersistableSuperclassInit
public static final String MN_LoadClass
public static final String MN_CopyField
public static final String MN_CopyFields
public static final String MN_CopyKeyFieldsFromObjectId
public static final String MN_CopyKeyFieldsToObjectId
public static final String MN_ProvideField
public static final String MN_ProvideFields
public static final String MN_ReplaceField
public static final String MN_ReplaceFields
public static final String MN_ReplaceFlags
public static final String MN_ReplaceStateManager
public static final String MN_ReplaceDetachedState
public static final String MN_MakeDirty
public static final String MN_MakeDirtyDetached
public static final String MN_NewInstance
public static final String MN_NewObjectIdInstance
public static final Class CL_Detachable
public static final Class CL_Persistable
public static final Class CL_ObjectIdFieldConsumer
public static final Class CL_ObjectIdFieldSupplier
public static final Class CL_PersistenceManager
public static final Class CL_StateManager
public static final String CN_JDOHelper
public static final String CN_JDOImplHelper
public static final String CN_JDOFatalInternalException
public static final String CN_DetachedFieldAccessException
public static final String ACN_StateManager
public static final String ACN_PersistenceManager
public static final String ACN_Persistable
public static final String ACN_Detachable
public static final String ACN_ObjectIdFieldConsumer
public static final String ACN_ObjectIdFieldSupplier
public static final String ACN_DetachedFieldAccessException
public static final String ACN_FatalInternalException
public static final String ACN_Helper
public static final String ACN_ImplHelper
public static final String CD_ByteIdentity
public static final String CD_CharIdentity
public static final String CD_IntIdentity
public static final String CD_LongIdentity
public static final String CD_ShortIdentity
public static final String CD_StringIdentity
public static final String CD_ObjectIdentity
public static final String CD_StateManager
public static final String CD_PersistenceManager
public static final String CD_PersistenceCapable
public static final String CD_Detachable
public static final String CD_ObjectIdFieldConsumer
public static final String CD_ObjectIdFieldSupplier
public static final String CD_String
public static final String CD_Object
protected String inputResourceName
protected byte[] inputBytes
protected final Class cls
protected byte[] classBytes
protected byte[] pkClassBytes
protected String asmClassName
protected String classDescriptor
| Constructor Detail |
|---|
public ASMClassEnhancer(org.datanucleus.metadata.ClassMetaData cmd,
org.datanucleus.ClassLoaderResolver clr,
org.datanucleus.metadata.MetaDataManager mmgr)
cmd - MetaData for the class to be enhancedclr - ClassLoader resolvermmgr - MetaData manager
public ASMClassEnhancer(org.datanucleus.metadata.ClassMetaData cmd,
org.datanucleus.ClassLoaderResolver clr,
org.datanucleus.metadata.MetaDataManager mmgr,
byte[] classBytes)
cmd - MetaData for the class to be enhancedclr - ClassLoader resolvermmgr - MetaData managerclassBytes - Bytes of the class to enhance| Method Detail |
|---|
public static String getClassNameForFileName(String filename)
filename - Name of the file
public static boolean useFrames()
public Class getClassEnhanced()
public String getASMClassName()
public String getClassDescriptor()
protected void initialiseMethodsList()
initialiseMethodsList in class AbstractClassEnhancerprotected void initialiseFieldsList()
initialiseFieldsList in class AbstractClassEnhancerpublic 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 String getStateManagerFieldName()
ClassEnhancer
public String getFlagsFieldName()
ClassEnhancer
public String getFieldNamesFieldName()
ClassEnhancer
public String getFieldTypesFieldName()
ClassEnhancer
public String getFieldFlagsFieldName()
ClassEnhancer
public String getPersistableSuperclassFieldName()
ClassEnhancer
public String getInheritedFieldCountFieldName()
ClassEnhancer
public String getDetachedStateFieldName()
ClassEnhancer
public String getSerialVersionUidFieldName()
ClassEnhancer
public String getFieldNamesInitMethodName()
ClassEnhancer
public String getFieldTypesInitMethodName()
ClassEnhancer
public String getFieldFlagsInitMethodName()
ClassEnhancer
public String getGetObjectIdMethodName()
ClassEnhancer
public String getGetTransactionalObjectIdMethodName()
ClassEnhancer
public String getGetVersionMethodName()
ClassEnhancer
public String getIsDetachedMethodName()
ClassEnhancer
public String getIsDetachedInternalMethodName()
ClassEnhancer
public String getIsDeletedMethodName()
ClassEnhancer
public String getIsDirtyMethodName()
ClassEnhancer
public String getIsNewMethodName()
ClassEnhancer
public String getIsPersistentMethodName()
ClassEnhancer
public String getIsTransactionalMethodName()
ClassEnhancer
public String getGetPersistenceManagerMethodName()
ClassEnhancer
public String getPreSerializeMethodName()
ClassEnhancer
public String getGetInheritedFieldCountMethodName()
ClassEnhancer
public String getSuperCloneMethodName()
ClassEnhancer
public String getGetManagedFieldCountMethodName()
ClassEnhancer
public String getPersistableSuperclassInitMethodName()
ClassEnhancer
public String getLoadClassMethodName()
ClassEnhancer
public String getCopyFieldMethodName()
ClassEnhancer
public String getCopyFieldsMethodName()
ClassEnhancer
public String getCopyKeyFieldsFromObjectIdMethodName()
ClassEnhancer
public String getCopyKeyFieldsToObjectIdMethodName()
ClassEnhancer
public String getProvideFieldMethodName()
ClassEnhancer
public String getProvideFieldsMethodName()
ClassEnhancer
public String getReplaceFieldMethodName()
ClassEnhancer
public String getReplaceFieldsMethodName()
ClassEnhancer
public String getReplaceFlagsMethodName()
ClassEnhancer
public String getReplaceStateManagerMethodName()
ClassEnhancer
public String getReplaceDetachedStateMethodName()
ClassEnhancer
public String getMakeDirtyMethodName()
ClassEnhancer
public String getMakeDirtyDetachedMethodName()
ClassEnhancer
public String getNewInstanceMethodName()
ClassEnhancer
public String getNewObjectIdInstanceMethodName()
ClassEnhancer
public String getGetMethodPrefixMethodName()
ClassEnhancer
public String getSetMethodPrefixMethodName()
ClassEnhancer
public String getHelperClassName()
ClassEnhancer
public String getImplHelperClassName()
ClassEnhancer
public String getFatalInternalExceptionClassName()
ClassEnhancer
public String getDetachedFieldAccessExceptionClassName()
ClassEnhancer
public String getStateManagerAsmClassName()
ClassEnhancer
public String getPersistenceManagerAsmClassName()
ClassEnhancer
public String getPersistableAsmClassName()
ClassEnhancer
public String getDetachableAsmClassName()
ClassEnhancer
public String getObjectIdFieldConsumerAsmClassName()
ClassEnhancer
public String getObjectIdFieldSupplierAsmClassName()
ClassEnhancer
public String getDetachedFieldAccessExceptionAsmClassName()
ClassEnhancer
public String getFatalInternalExceptionAsmClassName()
ClassEnhancer
public String getHelperAsmClassName()
ClassEnhancer
public String getImplHelperAsmClassName()
ClassEnhancer
public String getByteIdentityDescriptor()
ClassEnhancer
public String getCharIdentityDescriptor()
ClassEnhancer
public String getIntIdentityDescriptor()
ClassEnhancer
public String getLongIdentityDescriptor()
ClassEnhancer
public String getShortIdentityDescriptor()
ClassEnhancer
public String getStringIdentityDescriptor()
ClassEnhancer
public String getObjectIdentityDescriptor()
ClassEnhancer
public String getStateManagerDescriptor()
ClassEnhancer
public String getPersistenceManagerDescriptor()
ClassEnhancer
public String getPersistableDescriptor()
ClassEnhancer
public String getDetachableDescriptor()
ClassEnhancer
public String getSingleFieldIdentityDescriptor(String oidClassName)
oidClassName - Name of the SingleFieldIdentity class
public String getTypeDescriptorForSingleFieldIdentityGetKey(String oidClassName)
ClassEnhancer
oidClassName - Single-field identity class name
public String getTypeNameForUseWithSingleFieldIdentity(String oidClassName)
ClassEnhancer
oidClassName - Name of the single field identity class
public String getObjectIdFieldConsumerDescriptor()
ClassEnhancer
public String getObjectIdFieldSupplierDescriptor()
ClassEnhancer
public Class getPersistenceManagerClass()
ClassEnhancer
public Class getStateManagerClass()
ClassEnhancer
public Class getPersistableClass()
ClassEnhancer
public Class getDetachableClass()
ClassEnhancer
public Class getObjectIdFieldSupplierClass()
ClassEnhancer
public Class getObjectIdFieldConsumerClass()
ClassEnhancer
public Class getObjectIdentityClass()
ClassEnhancer
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||