|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.mockrunner.util.common.MethodUtil
public class MethodUtil
| Constructor Summary | |
|---|---|
MethodUtil()
|
|
| Method Summary | |
|---|---|
static boolean |
areMethodsEqual(java.lang.reflect.Method method1,
java.lang.reflect.Method method2)
Returns if the two specified methods are equal as defined by Method.equals() except that
the methods can be defined by different classes. |
static java.lang.reflect.Method[] |
getMatchingDeclaredMethods(java.lang.Class theClass,
java.lang.String expr)
Returns the declared methods of the specified class whose names are matching the specified regular expression. |
static java.lang.reflect.Method[][] |
getMethodsSortedByInheritanceHierarchy(java.lang.Class theClass)
Returns all non-static methods declared by the specified class and its superclasses. |
static java.util.Set |
getOverriddenMethods(java.lang.Class clazz,
java.lang.reflect.Method[] methods)
Returns all methods in methods that are overridden in
the specified class hierarchy. |
static java.lang.Object |
invoke(java.lang.Object object,
java.lang.String methodName)
Invokes the method with the specified name on the specified object and throws a NestedApplicationException,
if the invocation fails. |
static java.lang.Object |
invoke(java.lang.Object object,
java.lang.String methodName,
java.lang.Object parameter)
Invokes the method with the specified name on the specified object and throws a NestedApplicationException,
if the invocation fails. |
static boolean |
overrides(java.lang.reflect.Method method1,
java.lang.reflect.Method method2)
Returns if method2 overrides method1. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public MethodUtil()
| Method Detail |
|---|
public static java.lang.Object invoke(java.lang.Object object,
java.lang.String methodName)
NestedApplicationException,
if the invocation fails. The method must be public and must not
have any parameters.
object - the object the method is invoked frommethodName - the name of the method
public static java.lang.Object invoke(java.lang.Object object,
java.lang.String methodName,
java.lang.Object parameter)
NestedApplicationException,
if the invocation fails. The method must be public and must have
exactly one paremeter of the type specified by the given
parameter.
object - the object the method is invoked frommethodName - the name of the methodparameter - the parameter, must not be null
public static boolean areMethodsEqual(java.lang.reflect.Method method1,
java.lang.reflect.Method method2)
Method.equals() except that
the methods can be defined by different classes.
method1 - the first method to comparemethod2 - the second method to compare
true if the methods are equal, false
otherwise
java.lang.NullPointerException - if one of the methods is null
public static boolean overrides(java.lang.reflect.Method method1,
java.lang.reflect.Method method2)
method2 overrides method1.
method1 - method to be overriddenmethod2 - overriding method
true if method2 overrides method1, false
otherwise
java.lang.NullPointerException - if one of the methods is null
public static java.util.Set getOverriddenMethods(java.lang.Class clazz,
java.lang.reflect.Method[] methods)
methods that are overridden in
the specified class hierarchy. The returned Set contains
all overridden methods and all overriding methods.
clazz - the class hierarchymethods - the Set of methods
public static java.lang.reflect.Method[] getMatchingDeclaredMethods(java.lang.Class theClass,
java.lang.String expr)
theClass - the class whose methods are examinedexpr - the regular expression
public static java.lang.reflect.Method[][] getMethodsSortedByInheritanceHierarchy(java.lang.Class theClass)
java.lang.Object.
theClass - the class whose methods are examined
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||