|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.easymock.internal.ReflectionUtils
public final class ReflectionUtils
| Field Summary | |
|---|---|
static Method |
OBJECT_EQUALS
|
static Method |
OBJECT_FINALIZE
|
static Method |
OBJECT_HASHCODE
|
static Method |
OBJECT_TOSTRING
|
| Method Summary | ||
|---|---|---|
static Method |
findMethod(Class<?> clazz,
String name)
Attempt to find a Method on the supplied class with the supplied
name and no parameters. |
|
static Method |
findMethod(Class<?> clazz,
String name,
Class<?>... paramTypes)
Attempt to find a Method on the supplied class with the supplied
name and parameter types. |
|
static
|
getConstructor(Class<T> clazz,
Object... objs)
Returns a constructor that contains objs as arguments. |
|
static Method |
getDeclaredMethod(Class<?> clazz,
String name,
Class<?>[] paramTypes)
Basically calls getDeclaredMethod on a Class but wraps the NoSuchMethodException into a Runtime. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final Method OBJECT_EQUALS
public static final Method OBJECT_HASHCODE
public static final Method OBJECT_TOSTRING
public static final Method OBJECT_FINALIZE
| Method Detail |
|---|
public static Method findMethod(Class<?> clazz,
String name)
Method on the supplied class with the supplied
name and no parameters. Searches all superclasses up to
Object.
Returns null if no Method can be found.
clazz - the class to introspectname - the name of the method
null if none found
public static Method findMethod(Class<?> clazz,
String name,
Class<?>... paramTypes)
Method on the supplied class with the supplied
name and parameter types. Searches all superclasses up to
Object.
Returns null if no Method can be found.
clazz - the class to introspectname - the name of the methodparamTypes - the parameter types of the method (may be null to
indicate any signature)
null if none found
public static <T> Constructor<T> getConstructor(Class<T> clazz,
Object... objs)
throws NoSuchMethodException
objs as arguments.
We could not do something like clazz.getConstructor(objs.class())
because that would require casting all the passed arguments to the exact
parameter types of the desired constructor.
T - type of the class searchedclazz - class on which we are searching the constructorobjs - list of arguments of the constructor
objs
NoSuchMethodException - when the constructor with args does not exist or is
ambiguous
public static Method getDeclaredMethod(Class<?> clazz,
String name,
Class<?>[] paramTypes)
clazz - class on which the getDeclaredMethod is calledname - method nameparamTypes - method parameters
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||