public final class MethodIdentifier extends Object implements Serializable
Modifier and Type | Field and Description |
---|---|
static MethodIdentifier |
EQUALS
The method identifier for
Object.equals() . |
static MethodIdentifier |
FINALIZE
The method identifier for
Object.finalize() . |
static MethodIdentifier |
HASH_CODE
The method identifier for
Object.hashCode() . |
static MethodIdentifier |
TO_STRING
The method identifier for
Object.toString() . |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(MethodIdentifier other)
Determine whether this object is equal to another.
|
boolean |
equals(Object other)
Determine whether this object is equal to another.
|
static MethodIdentifier |
getIdentifier(Class<?> returnType,
String name,
Class<?>... parameterTypes)
Construct a new instance using class objects for the parameter types.
|
static MethodIdentifier |
getIdentifier(String returnType,
String name,
String... parameterTypes)
Construct a new instance using string names for the return and parameter types.
|
static MethodIdentifier |
getIdentifierForMethod(Method method)
Get an identifier for the given reflection method.
|
String |
getName()
Get the method name.
|
String[] |
getParameterTypes()
Get the parameter type names, as strings.
|
Method |
getPublicMethod(Class<?> clazz)
Look up a public method matching this method identifier using reflection.
|
String |
getReturnType()
Get the method return type name, as a string.
|
int |
hashCode()
Get the hash code for this method identifier.
|
String |
toString()
Get the human-readable representation of this identifier.
|
public static final MethodIdentifier EQUALS
Object.equals()
.public static final MethodIdentifier HASH_CODE
Object.hashCode()
.public static final MethodIdentifier TO_STRING
Object.toString()
.public static final MethodIdentifier FINALIZE
Object.finalize()
.public String getName()
public String[] getParameterTypes()
public String getReturnType()
public boolean equals(Object other)
public boolean equals(MethodIdentifier other)
other
- the other objecttrue
if they are equal, false
otherwisepublic int hashCode()
n * 7 + (r * 7 + a)where n is the method name's hash code, r is the method return type's name's hash code and a is the result of calling
Arrays.hashCode(Object[])
on the parameter type name list (of
strings).public Method getPublicMethod(Class<?> clazz) throws NoSuchMethodException, ClassNotFoundException
clazz
- the class to searchNoSuchMethodException
- if no such method existsClassNotFoundException
- if one of the classes referenced by this identifier are not found in clazz
's
class loaderpublic String toString()
public static MethodIdentifier getIdentifierForMethod(Method method)
method
- the methodpublic static MethodIdentifier getIdentifier(Class<?> returnType, String name, Class<?>... parameterTypes)
returnType
- the method return typename
- the method nameparameterTypes
- the method parameter typespublic static MethodIdentifier getIdentifier(String returnType, String name, String... parameterTypes)
returnType
- the return type namename
- the method nameparameterTypes
- the method parameter type namesCopyright © 2012 JBoss by Red Hat. All Rights Reserved.