org.datanucleus.enhancer
Interface ClassEnhancer

All Known Implementing Classes:
AbstractClassEnhancer, ASMClassEnhancer

public interface ClassEnhancer

Interface representation of an enhancer of a class.


Field Summary
static String OPTION_GENERATE_DEFAULT_CONSTRUCTOR
          Option for generating the default constructor.
static String OPTION_GENERATE_DETACH_LISTENER
          Option for use the detach listener.
static String OPTION_GENERATE_PK
          Option for generating the default constructor.
 
Method Summary
 boolean enhance()
          Method to enhance the class definition internally.
 String getByteIdentityDescriptor()
          Descriptor for ByteIdentity.
 String getCharIdentityDescriptor()
          Descriptor for CharIdentity.
 byte[] getClassBytes()
          Access the class bytecode.
 org.datanucleus.ClassLoaderResolver getClassLoaderResolver()
          Accessor for the ClassLoaderResolver in use.
 org.datanucleus.metadata.ClassMetaData getClassMetaData()
          Accessor for the ClassMetaData for the 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.
 org.datanucleus.metadata.MetaDataManager getMetaDataManager()
          Accessor for the MetaData manager in use.
 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()
          Access the generated primary-key class bytecode.
 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.
 boolean hasOption(String name)
          Accessor for whether a particular option is enabled.
 void save(String directoryName)
          Method to save the (current) class definition bytecode into a class file.
 void setOptions(Collection<String> options)
          Method to set the options controlling the enhancement.
 boolean validate()
          Validate whether the class is enhanced.
 

Field Detail

OPTION_GENERATE_DEFAULT_CONSTRUCTOR

static final String OPTION_GENERATE_DEFAULT_CONSTRUCTOR
Option for generating the default constructor.

See Also:
Constant Field Values

OPTION_GENERATE_PK

static final String OPTION_GENERATE_PK
Option for generating the default constructor.

See Also:
Constant Field Values

OPTION_GENERATE_DETACH_LISTENER

static final String OPTION_GENERATE_DETACH_LISTENER
Option for use the detach listener.

See Also:
Constant Field Values
Method Detail

setOptions

void setOptions(Collection<String> options)
Method to set the options controlling the enhancement.

Parameters:
options - The options

hasOption

boolean hasOption(String name)
Accessor for whether a particular option is enabled.

Parameters:
name - Name of the option
Returns:
Whether it has this option

validate

boolean validate()
Validate whether the class is enhanced.

Returns:
Return true if already enhanced class.

enhance

boolean enhance()
Method to enhance the class definition internally.

Returns:
Whether the class was enhanced successfully

save

void save(String directoryName)
          throws IOException
Method to save the (current) class definition bytecode into a class file. Only has effect if the bytecode has been modified (by enhance()). If directoryName is specified it will be written to $directoryName/className.class else will overwrite the existing class.

Parameters:
directoryName - Name of a directory (or null to overwrite the class)
Throws:
IOException - If an I/O error occurs in the write.

getClassBytes

byte[] getClassBytes()
Access the class bytecode.

Returns:
the class in byte array format

getPrimaryKeyClassBytes

byte[] getPrimaryKeyClassBytes()
Access the generated primary-key class bytecode.

Returns:
the primary-key class in byte array format

getMetaDataManager

org.datanucleus.metadata.MetaDataManager getMetaDataManager()
Accessor for the MetaData manager in use.

Returns:
MetaData manager

getClassLoaderResolver

org.datanucleus.ClassLoaderResolver getClassLoaderResolver()
Accessor for the ClassLoaderResolver in use.

Returns:
ClassLoader resolver

getClassMetaData

org.datanucleus.metadata.ClassMetaData getClassMetaData()
Accessor for the ClassMetaData for the class.

Returns:
MetaData for the class

getStateManagerFieldName

String getStateManagerFieldName()
Field name of StateManager


getFlagsFieldName

String getFlagsFieldName()
Field name of Flags


getFieldNamesFieldName

String getFieldNamesFieldName()
Field name of FieldNames


getFieldTypesFieldName

String getFieldTypesFieldName()
Field name of FieldTypes


getFieldFlagsFieldName

String getFieldFlagsFieldName()
Field name of FieldFlags


getPersistableSuperclassFieldName

String getPersistableSuperclassFieldName()
Field name of PersistenceCapableSuperclass


getInheritedFieldCountFieldName

String getInheritedFieldCountFieldName()
Field name of FieldCount


getDetachedStateFieldName

String getDetachedStateFieldName()
Field name of DetachedState


getSerialVersionUidFieldName

String getSerialVersionUidFieldName()
Field name of serialVersionUID


getFieldNamesInitMethodName

String getFieldNamesInitMethodName()
Method name for initialising FieldNames


getFieldTypesInitMethodName

String getFieldTypesInitMethodName()
Method name for initialising FieldTypes


getFieldFlagsInitMethodName

String getFieldFlagsInitMethodName()
Method name for initialising FieldFlags


getGetObjectIdMethodName

String getGetObjectIdMethodName()
Method name for object id accessor


getGetTransactionalObjectIdMethodName

String getGetTransactionalObjectIdMethodName()
Method name for transactional object id accessor


getGetVersionMethodName

String getGetVersionMethodName()
Method name for version accessor


getIsDetachedMethodName

String getIsDetachedMethodName()
Method name of IsDetached


getIsDetachedInternalMethodName

String getIsDetachedInternalMethodName()
Method name of IsDetachedInternal


getIsDeletedMethodName

String getIsDeletedMethodName()
Method name of IsDeleted


getIsDirtyMethodName

String getIsDirtyMethodName()
Method name of IsDirty


getIsNewMethodName

String getIsNewMethodName()
Method name of IsNew


getIsPersistentMethodName

String getIsPersistentMethodName()
Method name of IsPersistent


getIsTransactionalMethodName

String getIsTransactionalMethodName()
Method name of IsTransactional


getGetPersistenceManagerMethodName

String getGetPersistenceManagerMethodName()
Method name of GetPersistenceManager


getPreSerializeMethodName

String getPreSerializeMethodName()
Method name of PreSerialize


getGetInheritedFieldCountMethodName

String getGetInheritedFieldCountMethodName()
Method name for GetInheritedFieldCount


getSuperCloneMethodName

String getSuperCloneMethodName()
Method name for SuperClone


getGetManagedFieldCountMethodName

String getGetManagedFieldCountMethodName()
Method name for GetManagedFieldCount


getPersistableSuperclassInitMethodName

String getPersistableSuperclassInitMethodName()
Method name for PersistableSuperclassInit


getLoadClassMethodName

String getLoadClassMethodName()
Method name of LoadClass


getCopyFieldMethodName

String getCopyFieldMethodName()
Method name of CopyField


getCopyFieldsMethodName

String getCopyFieldsMethodName()
Method name of CopyFields


getCopyKeyFieldsFromObjectIdMethodName

String getCopyKeyFieldsFromObjectIdMethodName()
Method name of CopyFieldsFromObjectId


getCopyKeyFieldsToObjectIdMethodName

String getCopyKeyFieldsToObjectIdMethodName()
Method name of CopyFieldsToObjectId


getProvideFieldMethodName

String getProvideFieldMethodName()
Method name of ProvideField


getProvideFieldsMethodName

String getProvideFieldsMethodName()
Method name of ProvideFields


getReplaceFieldMethodName

String getReplaceFieldMethodName()
Method name of ReplaceField


getReplaceFieldsMethodName

String getReplaceFieldsMethodName()
Method name of ReplaceFields.


getReplaceFlagsMethodName

String getReplaceFlagsMethodName()
Method name of ReplaceFlags.


getReplaceStateManagerMethodName

String getReplaceStateManagerMethodName()
Method name of ReplaceStateManager.


getReplaceDetachedStateMethodName

String getReplaceDetachedStateMethodName()
Method name of ReplaceDetachedState.


getMakeDirtyMethodName

String getMakeDirtyMethodName()
Method name of MakeDirty.


getMakeDirtyDetachedMethodName

String getMakeDirtyDetachedMethodName()
Method name of MakeDirtyDetached.


getNewInstanceMethodName

String getNewInstanceMethodName()
Method name of NewInstance.


getNewObjectIdInstanceMethodName

String getNewObjectIdInstanceMethodName()
Method name of NewObjectIdInstance.


getGetMethodPrefixMethodName

String getGetMethodPrefixMethodName()
Prefix for method names for getXXX.


getSetMethodPrefixMethodName

String getSetMethodPrefixMethodName()
Prefix for method names for setXXX.


getHelperClassName

String getHelperClassName()
Class name of Helper


getImplHelperClassName

String getImplHelperClassName()
Class name of ImplHelper


getFatalInternalExceptionClassName

String getFatalInternalExceptionClassName()
Class name of FatalInternalException


getDetachedFieldAccessExceptionClassName

String getDetachedFieldAccessExceptionClassName()
Class name of DetachedFieldAccessException


getStateManagerAsmClassName

String getStateManagerAsmClassName()
ASM class name for StateManager.


getPersistenceManagerAsmClassName

String getPersistenceManagerAsmClassName()
ASM class name for PersistenceManager.


getPersistableAsmClassName

String getPersistableAsmClassName()
ASM class name for Persistable.


getDetachableAsmClassName

String getDetachableAsmClassName()
ASM class name for Detachable.


getObjectIdFieldConsumerAsmClassName

String getObjectIdFieldConsumerAsmClassName()
ASM class name for ObjectIdFieldConsumer.


getObjectIdFieldSupplierAsmClassName

String getObjectIdFieldSupplierAsmClassName()
ASM class name for ObjectIdFieldSupplier.


getDetachedFieldAccessExceptionAsmClassName

String getDetachedFieldAccessExceptionAsmClassName()
ASM class name for DetachedFieldAccessException.


getFatalInternalExceptionAsmClassName

String getFatalInternalExceptionAsmClassName()
ASM class name for FatalInternalException.


getHelperAsmClassName

String getHelperAsmClassName()
ASM class name for Helper.


getImplHelperAsmClassName

String getImplHelperAsmClassName()
ASM class name for ImplHelper.


getByteIdentityDescriptor

String getByteIdentityDescriptor()
Descriptor for ByteIdentity.


getCharIdentityDescriptor

String getCharIdentityDescriptor()
Descriptor for CharIdentity.


getIntIdentityDescriptor

String getIntIdentityDescriptor()
Descriptor for IntIdentity.


getLongIdentityDescriptor

String getLongIdentityDescriptor()
Descriptor for LongIdentity.


getShortIdentityDescriptor

String getShortIdentityDescriptor()
Descriptor for ShortIdentity.


getStringIdentityDescriptor

String getStringIdentityDescriptor()
Descriptor for StringIdentity.


getObjectIdentityDescriptor

String getObjectIdentityDescriptor()
Descriptor for ObjectIdentity.


getSingleFieldIdentityDescriptor

String getSingleFieldIdentityDescriptor(String oidClassName)
Accessor for the descriptor for a SingleFieldIdentity type.

Parameters:
oidClassName - Name of the SingleFieldIdentity class
Returns:
The descriptor of the SingleFieldIdentity type

getTypeDescriptorForSingleFieldIdentityGetKey

String getTypeDescriptorForSingleFieldIdentityGetKey(String oidClassName)
Method to return the type descriptor for the key of the provided single-field identity class name.

Parameters:
oidClassName - Single-field identity class name
Returns:
The type descriptor for the key

getTypeNameForUseWithSingleFieldIdentity

String getTypeNameForUseWithSingleFieldIdentity(String oidClassName)
Convenience method to give the method type name for a singleFieldIdentity class name. Used for aaaCopyKeyFields[To/From]ObjectId and defines the "type name" used for things like storeXXXField.

Parameters:
oidClassName - Name of the single field identity class
Returns:
Name for the method

getStateManagerDescriptor

String getStateManagerDescriptor()
Descriptor for javax.jdo.spi.StateManager.


getPersistenceManagerDescriptor

String getPersistenceManagerDescriptor()
Descriptor for javax.jdo.PersistenceManager.


getPersistableDescriptor

String getPersistableDescriptor()
Descriptor for javax.jdo.spi.PersistenceCapable.


getDetachableDescriptor

String getDetachableDescriptor()
Descriptor for javax.jdo.spi.Detachable.


getObjectIdFieldConsumerDescriptor

String getObjectIdFieldConsumerDescriptor()
Descriptor for ObjectIdFieldConsumer.


getObjectIdFieldSupplierDescriptor

String getObjectIdFieldSupplierDescriptor()
Descriptor for ObjectIdFieldSupplier.


getPersistenceManagerClass

Class getPersistenceManagerClass()
Class for the PersistenceManager interface.


getStateManagerClass

Class getStateManagerClass()
Class for the StateManager interface.


getPersistableClass

Class getPersistableClass()
Class for the Persistable interface.


getDetachableClass

Class getDetachableClass()
Class for the Detachable interface.


getObjectIdFieldSupplierClass

Class getObjectIdFieldSupplierClass()
Class for ObjectIdFieldSupplier.


getObjectIdFieldConsumerClass

Class getObjectIdFieldConsumerClass()
Class for ObjectIdFieldConsumer.


getObjectIdentityClass

Class getObjectIdentityClass()
Class for ObjectIdentity.



Copyright © 2012. All Rights Reserved.