public class MethodUtil extends Object
| Constructor and Description |
|---|
MethodUtil() |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
areMethodsEqual(Method method1,
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 Method[] |
getMatchingDeclaredMethods(Class theClass,
String expr)
Returns the declared methods of the specified class whose names are matching
the specified regular expression.
|
static Method[][] |
getMethodsSortedByInheritanceHierarchy(Class theClass)
Returns all non-static methods declared by the specified class and its
superclasses.
|
static Set |
getOverriddenMethods(Class clazz,
Method[] methods)
Returns all methods in
methods that are overridden in
the specified class hierarchy. |
static Object |
invoke(Object object,
String methodName)
Invokes the method with the specified name on the specified object
and throws a
NestedApplicationException,
if the invocation fails. |
static Object |
invoke(Object object,
String methodName,
Object parameter)
Invokes the method with the specified name on the specified object
and throws a
NestedApplicationException,
if the invocation fails. |
static boolean |
overrides(Method method1,
Method method2)
Returns if
method2 overrides method1. |
public static Object invoke(Object object, 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 methodpublic static Object invoke(Object object, String methodName, 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 nullpublic static boolean areMethodsEqual(Method method1, Method method2)
Method.equals() except that
the methods can be defined by different classes.method1 - the first method to comparemethod2 - the second method to comparetrue if the methods are equal, false
otherwiseNullPointerException - if one of the methods is nullpublic static boolean overrides(Method method1, Method method2)
method2 overrides method1.method1 - method to be overriddenmethod2 - overriding methodtrue if method2 overrides method1, false
otherwiseNullPointerException - if one of the methods is nullpublic static Set getOverriddenMethods(Class clazz, 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 methodspublic static Method[] getMatchingDeclaredMethods(Class theClass, String expr)
theClass - the class whose methods are examinedexpr - the regular expressionpublic static Method[][] getMethodsSortedByInheritanceHierarchy(Class theClass)
java.lang.Object.theClass - the class whose methods are examinedCopyright © 2003-2015. All Rights Reserved.