public class MethodUtils extends Object
Constructor and Description |
---|
MethodUtils()
MethodUtils instances should NOT be constructed in standard programming. |
Modifier and Type | Method and Description |
---|---|
static Method |
getAccessibleMethod(Method method)
Returns an accessible method (that is, one that can be invoked via reflection) that implements
the specified Method.
|
static Method |
getMatchingAccessibleMethod(Class<?> cls,
String methodName,
Class<?>... parameterTypes)
Finds an accessible method that matches the given name and has compatible parameters.
|
public MethodUtils()
MethodUtils
instances should NOT be constructed in standard programming. Instead, the
class should be used as MethodUtils.getAccessibleMethod(method)
.
This constructor is public
to permit tools that require a JavaBean instance to
operate.
public static Method getAccessibleMethod(Method method)
null
.method
- The method that we wish to callpublic static Method getMatchingAccessibleMethod(Class<?> cls, String methodName, Class<?>... parameterTypes)
This method can match primitive parameter by passing in wrapper classes. For example, a
Boolean
will match a primitive boolean
parameter.
cls
- find method in this classmethodName
- find method with this nameparameterTypes
- find method with most compatible parameters