public class MethodUtils extends Object
| Modifier and Type | Field and Description |
|---|---|
static Class<?>[] |
EMPTY_PARAMETER_CLASSTYPES |
static Object[] |
EMPTY_PARAMETER_VALUES |
| Modifier and Type | Method and Description |
|---|---|
static Method |
findMethod(Class<?> clazz,
String methodName,
Class<?>[] parameterTypes)
Returns a Method object that reflects the specified declared method of
the class or interface represented by given class.
Returns null if not find. |
static Method |
findPublicMethod(Class<?> clazz,
String methodName,
Class<?>[] parameterTypes)
Returns a public Method object that reflects the specified public member
method of the class or interface represented by given class.
Returns null if not find. |
static Object |
invoke(Object source,
Method method,
Object[] parameterValues)
Invokes given method on the given source object with the specified
parameters.
|
static Object |
invoke(Object source,
String methodName,
Class<?>[] parameterTypes,
Object[] parameterValues)
Invokes method which name equals given method name and parameter types
equals given parameter types on the given source with the given
parameters.
|
public static final Class<?>[] EMPTY_PARAMETER_CLASSTYPES
public static final Object[] EMPTY_PARAMETER_VALUES
public static Method findPublicMethod(Class<?> clazz, String methodName, Class<?>[] parameterTypes)
clazz - the method belong to.methodName - the name of the method which you want to get.parameterTypes - the parameter types of the method which you want to get.public static Method findMethod(Class<?> clazz, String methodName, Class<?>[] parameterTypes)
clazz - the method belong to.methodName - the name of the method which you want to get.parameterTypes - the parameter types of the method which you want to get.public static Object invoke(Object source, String methodName, Class<?>[] parameterTypes, Object[] parameterValues) throws MethodException
source - the object which you want to handle.methodName - the name of the method which you want to call.parameterTypes - the parameter types of the method which you want to call.parameterValues - the parameter values of the method which you want to call.MethodExceptionpublic static Object invoke(Object source, Method method, Object[] parameterValues) throws MethodException
source - the object which you want to handle.method - the method which you want to call.parameterValues - the parameter values of the method which you want to call.MethodExceptionCopyright © 2014. All rights reserved.