org.datanucleus.enhancer
Class ClassMethod

java.lang.Object
  extended by org.datanucleus.enhancer.ClassMethod
Direct Known Subclasses:
ASMClassMethod, BCELClassMethod

public abstract class ClassMethod
extends java.lang.Object

Representation of a method that an enhanced class requires.


Field Summary
protected  int access
          Access flags for the method (public, protected etc).
protected  java.lang.String[] argNames
          Names of the arguments.
protected  java.lang.Object[] argTypes
          Types of the arguments.
protected  ClassEnhancer enhancer
          The parent enhancer.
protected  java.lang.String[] exceptions
          Exceptions that can be thrown.
protected static org.datanucleus.util.Localiser LOCALISER
          Localisation of messages
protected  java.lang.String methodName
          Name of the method.
protected  java.lang.Object returnType
          Return type for the method
 
Constructor Summary
ClassMethod(ClassEnhancer enhancer, java.lang.String name, int access, java.lang.Object returnType, java.lang.Object[] argTypes, java.lang.String[] argNames)
          Constructor.
ClassMethod(ClassEnhancer enhancer, java.lang.String name, int access, java.lang.Object returnType, java.lang.Object[] argTypes, java.lang.String[] argNames, java.lang.String[] exceptions)
          Constructor.
 
Method Summary
 void close()
          Method to close the definition of the class method.
 boolean equals(java.lang.Object o)
          Indicates whether some other object is "equal to" this one.
abstract  void execute()
          Method to add the contents of the class method.
 int getAccess()
          Accessor for the access
static java.lang.String getMethodAdditionMessage(java.lang.String methodName, java.lang.Object returnType, java.lang.Object[] argTypes, java.lang.String[] argNames)
          Convenience method to generate a message that a method has been added.
 java.lang.String getName()
          Accessor for the method name
 int hashCode()
          Return hash code of this instance.
abstract  void initialise()
          Method to initialise the class method.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOCALISER

protected static org.datanucleus.util.Localiser LOCALISER
Localisation of messages


enhancer

protected ClassEnhancer enhancer
The parent enhancer.


methodName

protected java.lang.String methodName
Name of the method.


access

protected int access
Access flags for the method (public, protected etc).


returnType

protected java.lang.Object returnType
Return type for the method


argTypes

protected java.lang.Object[] argTypes
Types of the arguments.


argNames

protected java.lang.String[] argNames
Names of the arguments.


exceptions

protected java.lang.String[] exceptions
Exceptions that can be thrown.

Constructor Detail

ClassMethod

public ClassMethod(ClassEnhancer enhancer,
                   java.lang.String name,
                   int access,
                   java.lang.Object returnType,
                   java.lang.Object[] argTypes,
                   java.lang.String[] argNames)
Constructor.

Parameters:
enhancer - ClassEnhancer
name - Name of the method
access - Access for the method (PUBLIC, PROTECTED etc)
returnType - Return type
argTypes - Argument type(s)
argNames - Argument name(s)

ClassMethod

public ClassMethod(ClassEnhancer enhancer,
                   java.lang.String name,
                   int access,
                   java.lang.Object returnType,
                   java.lang.Object[] argTypes,
                   java.lang.String[] argNames,
                   java.lang.String[] exceptions)
Constructor.

Parameters:
enhancer - ClassEnhancer
name - Name of the method
access - Access for the method (PUBLIC, PROTECTED etc)
returnType - Return type
argTypes - Argument type(s)
argNames - Argument name(s)
exceptions - Exceptions that can be thrown
Method Detail

getName

public java.lang.String getName()
Accessor for the method name

Returns:
Name of the method

getAccess

public int getAccess()
Accessor for the access

Returns:
Access for the method

initialise

public abstract void initialise()
Method to initialise the class 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

public int hashCode()
Return hash code of this instance.

Overrides:
hashCode in class java.lang.Object
Returns:
hash code of this instance

equals

public boolean equals(java.lang.Object o)
Indicates whether some other object is "equal to" this one.

Overrides:
equals in class java.lang.Object
Parameters:
o - the reference object with which to compare.
Returns:
true if this object is the same as the obj argument; false otherwise.

getMethodAdditionMessage

public static java.lang.String getMethodAdditionMessage(java.lang.String methodName,
                                                        java.lang.Object returnType,
                                                        java.lang.Object[] argTypes,
                                                        java.lang.String[] argNames)
Convenience method to generate a message that a method has been added.

Parameters:
methodName - Name of the method
returnType - Return type of the method
argTypes - arg types for the method
argNames - arg names for the method
Returns:
The message


Copyright © 2009. All Rights Reserved.