Class ClassMethod
java.lang.Object
org.datanucleus.enhancer.ClassMethod
- Direct Known Subclasses:
Clone, CopyField, CopyFields, CopyKeyFieldsFromObjectId, CopyKeyFieldsFromObjectId2, CopyKeyFieldsToObjectId, CopyKeyFieldsToObjectId2, DefaultConstructor, GetExecutionContext, GetInheritedFieldCount, GetManagedFieldCount, GetNormal, GetObjectId, GetStateManager, GetTransactionalObjectId, GetVersion, GetViaCheck, GetViaMediate, InitClass, InitFieldNames, IsDetached, IsDirty, IsXXX, LoadClass, MakeDirty, NewInstance1, NewInstance2, NewObjectIdInstance1, NewObjectIdInstance2, PreSerialize, ProvideField, ProvideFields, ReplaceDetachedState, ReplaceField, ReplaceFields, ReplaceFlags, ReplaceStateManager, SetNormal, SetViaCheck, SetViaMediate, WriteObject
Representation of a method that an enhanced class requires.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected intAccess flags for the method (public, protected etc).protected String[]Names of the arguments.protected Object[]Types of the arguments.protected ClassEnhancerThe parent enhancer.protected String[]Exceptions that can be thrown.protected StringName of the method.protected ObjectReturn type for the methodprotected MethodVisitorVisitor for use in updating the method of the class (set in initialise). -
Constructor Summary
ConstructorsConstructorDescriptionClassMethod(ClassEnhancer enhancer, String name, int access, Object returnType, Object[] argTypes, String[] argNames) Constructor.ClassMethod(ClassEnhancer enhancer, String name, int access, Object returnType, Object[] argTypes, String[] argNames, String[] exceptions) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Method to close the definition of the class method.booleanIndicates whether some other object is "equal to" this one.abstract voidexecute()Method to add the contents of the class method.intAccessor for the accessprotected ClassEnhancerConvenience accessor for the ClassEnhancerAccessor for the descriptor of the method.static StringgetMethodAdditionMessage(String methodName, Object returnType, Object[] argTypes, String[] argNames) Convenience method to generate a message that a method has been added.getName()Accessor for the method namegetNamer()inthashCode()Return hash code of this instance.voidDefault implementation of initialise, specifying the method based on the ClassMethod info.voidinitialise(ClassVisitor classVisitor) Method to initialise the class method.
-
Field Details
-
enhancer
The parent enhancer. -
methodName
Name of the method. -
access
protected int accessAccess flags for the method (public, protected etc). -
returnType
Return type for the method -
argTypes
Types of the arguments. -
argNames
Names of the arguments. -
exceptions
Exceptions that can be thrown. -
visitor
Visitor for use in updating the method of the class (set in initialise).
-
-
Constructor Details
-
ClassMethod
public ClassMethod(ClassEnhancer enhancer, String name, int access, Object returnType, Object[] argTypes, String[] argNames) Constructor.- Parameters:
enhancer- ClassEnhancername- Name of the methodaccess- Access for the method (PUBLIC, PROTECTED etc)returnType- Return typeargTypes- Argument type(s)argNames- Argument name(s)
-
ClassMethod
public ClassMethod(ClassEnhancer enhancer, String name, int access, Object returnType, Object[] argTypes, String[] argNames, String[] exceptions) Constructor.- Parameters:
enhancer- ClassEnhancername- Name of the methodaccess- Access for the method (PUBLIC, PROTECTED etc)returnType- Return typeargTypes- Argument type(s)argNames- Argument name(s)exceptions- Exceptions that can be thrown
-
-
Method Details
-
initialise
public void initialise()Default implementation of initialise, specifying the method based on the ClassMethod info. -
initialise
Method to initialise the class method.- Parameters:
classVisitor- Visitor for the class
-
getClassEnhancer
Convenience accessor for the ClassEnhancer- Returns:
- ClassEnhancer
-
getDescriptor
-
getNamer
-
getName
-
getAccess
public int getAccess()Accessor for the access- Returns:
- Access for the method
-
execute
public abstract void execute()Method to add the contents of the class method. -
close
public void close()Method to close the definition of the class method. This implementation simply logs a debug message to category ENHANCER. -
hashCode
-
equals
-
getMethodAdditionMessage
public static String getMethodAdditionMessage(String methodName, Object returnType, Object[] argTypes, String[] argNames) Convenience method to generate a message that a method has been added.- Parameters:
methodName- Name of the methodreturnType- Return type of the methodargTypes- arg types for the methodargNames- arg names for the method- Returns:
- The message
-