|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object sofya.base.MethodSignature
public class MethodSignature
This class represents a full method signature including class name. It is primarily intended to serve as a consistent key for method lookups in handlers. Various constructors are provided to facilitate convenient creation of instances of this class from several types of BCEL method-related objects.
The equals
and hashCode
methods of this class
are implemented to strictly conform to all contracts. The hash code
algorithm is based on the definition found in the Effective Java
Programming Language Guide.
Nested Class Summary | |
---|---|
static class |
MethodSignature.NameComparator
A utility comparator which orders method signatures. |
Constructor Summary | |
---|---|
MethodSignature(org.apache.bcel.generic.InvokeInstruction invoke,
org.apache.bcel.generic.ConstantPoolGen cpg)
Constructs a signature object from a BCEL InvokeInstruction
object. |
|
MethodSignature(org.apache.bcel.generic.MethodGen mg)
Constructs a signature object from a BCEL MethodGen object. |
|
MethodSignature(org.apache.bcel.classfile.Method m,
java.lang.String className)
Constructs a signature object from a BCEL Method object. |
|
MethodSignature(java.lang.String className,
MethodSignature signature)
Constructs a signature object which represents the same method bound to a different class. |
|
MethodSignature(java.lang.String className,
java.lang.String methodName,
java.lang.String signature)
Constructs a signature object from explicit signature constituents. |
|
MethodSignature(java.lang.String className,
java.lang.String methodName,
org.apache.bcel.generic.Type returnType,
org.apache.bcel.generic.Type[] argTypes)
Constructs a signature object from explicit signature constituents. |
Method Summary | |
---|---|
MethodSignature |
copy()
Creates a new method signature object which is a copy of this method signature. |
boolean |
equals(java.lang.Object obj)
Tests whether this method signature represents the same method as another method signature. |
java.lang.Class[] |
getArgumentClasses()
Gets the method's argument types as an array of java.lang.Class objects. |
org.apache.bcel.generic.Type[] |
getArgumentTypes()
Gets the method's argument types. |
java.lang.String |
getClassName()
Gets the name of the class implementing the method. |
java.lang.String |
getMethodName()
Gets the method's name. |
java.lang.Class |
getReturnClass()
Gets the java.lang.Class for the method's return type. |
org.apache.bcel.generic.Type |
getReturnType()
Gets the method's return type. |
java.lang.String |
getTypeSignature()
Gets the method's JNI-style type signature. |
int |
hashCode()
Returns the hash code for this method signature. |
java.lang.String |
toString()
Returns the string representation of this method signature. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public MethodSignature(org.apache.bcel.classfile.Method m, java.lang.String className)
Method
object.
m
- BCEL Method
representation of a method.className
- Name of the class implementing the method.public MethodSignature(org.apache.bcel.generic.MethodGen mg)
MethodGen
object.
mg
- BCEL MethodGen
representation of a method.public MethodSignature(org.apache.bcel.generic.InvokeInstruction invoke, org.apache.bcel.generic.ConstantPoolGen cpg)
InvokeInstruction
object.
invoke
- BCEL InvokeInstruction
representing a
method call.cpg
- Constant pool from the class containing the invoke
instruction (BCEL representation).public MethodSignature(java.lang.String className, java.lang.String methodName, org.apache.bcel.generic.Type returnType, org.apache.bcel.generic.Type[] argTypes)
className
- Name of the class implementing the method.methodName
- Name of the method.returnType
- Return type of the method.argTypes
- Types of the method's arguments.public MethodSignature(java.lang.String className, MethodSignature signature)
className
- Name of the new class which will be associated
with the method signature.signature
- Existing signature to be copied to a new
class binding.public MethodSignature(java.lang.String className, java.lang.String methodName, java.lang.String signature)
className
- Name of the class implementing the method.methodName
- Name of the method.signature
- JNI-style string providing thetype signature of the
method.Method Detail |
---|
public java.lang.String getClassName()
public java.lang.String getMethodName()
public org.apache.bcel.generic.Type getReturnType()
public java.lang.Class getReturnClass() throws java.lang.ClassNotFoundException
java.lang.Class
for the method's return type.
java.lang.ClassNotFoundException
public org.apache.bcel.generic.Type[] getArgumentTypes()
public java.lang.Class[] getArgumentClasses() throws java.lang.ClassNotFoundException
java.lang.Class
objects.
java.lang.ClassNotFoundException
public java.lang.String getTypeSignature()
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
obj
- Method signature against which this signature should
be tested for equivalence.
true
if this signature represents the same
method as the provided signature; that is, a virtual call would
bind to the same method for both signatures. Returns
false
if the signatures do not represent the same
method, or the argument is an instance of any class other
than a MethodSignature
(this preserves the contract
of the equals method).public int hashCode()
hashCode
in class java.lang.Object
public MethodSignature copy()
public java.lang.String toString()
toString
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |