public abstract class ClassMethod extends Object
Modifier and Type | Field and Description |
---|---|
protected int |
access
Access flags for the method (public, protected etc).
|
protected String[] |
argNames
Names of the arguments.
|
protected Object[] |
argTypes
Types of the arguments.
|
protected ClassEnhancer |
enhancer
The parent enhancer.
|
protected String[] |
exceptions
Exceptions that can be thrown.
|
protected String |
methodName
Name of the method.
|
protected Object |
returnType
Return type for the method
|
protected MethodVisitor |
visitor
Visitor for use in updating the method of the class (set in initialise).
|
Constructor and Description |
---|
ClassMethod(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.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Method to close the definition of the class method.
|
boolean |
equals(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
|
protected ClassEnhancer |
getClassEnhancer()
Convenience accessor for the ClassEnhancer
|
String |
getDescriptor()
Accessor for the descriptor of the method.
|
static String |
getMethodAdditionMessage(String methodName,
Object returnType,
Object[] argTypes,
String[] argNames)
Convenience method to generate a message that a method has been added.
|
String |
getName()
Accessor for the method name
|
EnhancementNamer |
getNamer() |
int |
hashCode()
Return hash code of this instance.
|
void |
initialise()
Default implementation of initialise, specifying the method based on the ClassMethod info.
|
void |
initialise(ClassVisitor classVisitor)
Method to initialise the class method.
|
protected ClassEnhancer enhancer
protected String methodName
protected int access
protected Object returnType
protected Object[] argTypes
protected String[] argNames
protected String[] exceptions
protected MethodVisitor visitor
public ClassMethod(ClassEnhancer enhancer, String name, int access, Object returnType, Object[] argTypes, String[] argNames)
enhancer
- ClassEnhancername
- Name of the methodaccess
- Access for the method (PUBLIC, PROTECTED etc)returnType
- Return typeargTypes
- Argument type(s)argNames
- Argument name(s)public ClassMethod(ClassEnhancer enhancer, String name, int access, Object returnType, Object[] argTypes, String[] argNames, String[] exceptions)
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 thrownpublic void initialise()
public void initialise(ClassVisitor classVisitor)
classVisitor
- Visitor for the classprotected ClassEnhancer getClassEnhancer()
public String getDescriptor()
public EnhancementNamer getNamer()
public String getName()
public int getAccess()
public abstract void execute()
public void close()
public int hashCode()
public boolean equals(Object o)
public static String getMethodAdditionMessage(String methodName, Object returnType, Object[] argTypes, String[] argNames)
methodName
- Name of the methodreturnType
- Return type of the methodargTypes
- arg types for the methodargNames
- arg names for the methodCopyright © 2019. All rights reserved.