public interface MethodUtils
| Modifier and Type | Method and Description |
|---|---|
static Predicate<Method> |
excludedDeclaredClass(Class<?> declaredClass)
|
static Method |
findMethod(Class type,
String methodName)
Find the
Method by the the specified type and method name without the parameter types |
static Method |
findMethod(Class type,
String methodName,
Class<?>... parameterTypes)
Find the
Method by the the specified type, method name and parameter types |
static Method |
findNearestOverriddenMethod(Method overrider)
Find the nearest overridden
method from the inherited class |
static Method |
findOverriddenMethod(Method overrider,
Class<?> declaringClass)
Find the overridden
method from the declaring class |
static List<Method> |
getAllDeclaredMethods(Class<?> declaringClass,
Predicate<Method>... methodsToFilter)
Get all declared
methods of the declared class, including the inherited methods. |
static List<Method> |
getAllMethods(Class<?> declaringClass,
Predicate<Method>... methodsToFilter)
Get all public
methods of the declared class, including the inherited methods. |
static List<Method> |
getDeclaredMethods(Class<?> declaringClass,
Predicate<Method>... methodsToFilter)
Get all declared
methods of the declared class, excluding the inherited methods |
static List<Method> |
getMethods(Class<?> declaringClass,
boolean includeInheritedTypes,
boolean publicOnly,
Predicate<Method>... methodsToFilter)
Get all
methods of the declared class |
static List<Method> |
getMethods(Class<?> declaringClass,
Predicate<Method>... methodsToFilter)
Get all public
methods of the declared class, including the inherited methods. |
static <T> T |
invokeMethod(Object object,
String methodName,
Object... methodParameters)
Invoke the target object and method
|
static boolean |
isDeprecated(Method method)
Check if the method is a deprecated method.
|
static boolean |
isGetter(Method method)
Return
true if the provided method is a get method. |
static boolean |
isMetaMethod(Method method)
Return
true If this method is a meta method. |
static boolean |
isSetter(Method method)
Return
true if the provided method is a set method. |
static boolean |
overrides(Method overrider,
Method overridden)
Tests whether one method, as a member of a given type,
overrides another method.
|
static boolean isSetter(Method method)
true if the provided method is a set method.
Otherwise, return false.method - the method to checkstatic boolean isGetter(Method method)
true if the provided method is a get method.
Otherwise, return false.method - the method to checkstatic boolean isMetaMethod(Method method)
true If this method is a meta method.
Otherwise, return false.method - the method to checkstatic boolean isDeprecated(Method method)
Deprecated annotation is declared on the class.
Return true if this annotation is present.
Otherwise, return false.method - the method to checkstatic Predicate<Method> excludedDeclaredClass(Class<?> declaredClass)
declaredClass - the declared class to excludestatic List<Method> getMethods(Class<?> declaringClass, boolean includeInheritedTypes, boolean publicOnly, Predicate<Method>... methodsToFilter)
methods of the declared classdeclaringClass - the declared classincludeInheritedTypes - include the inherited types, e,g. super classes or interfacespublicOnly - only public methodmethodsToFilter - (optional) the methods to be filteredListstatic List<Method> getDeclaredMethods(Class<?> declaringClass, Predicate<Method>... methodsToFilter)
methods of the declared class, excluding the inherited methodsdeclaringClass - the declared classmethodsToFilter - (optional) the methods to be filteredListgetMethods(Class, boolean, boolean, Predicate[])static List<Method> getMethods(Class<?> declaringClass, Predicate<Method>... methodsToFilter)
methods of the declared class, including the inherited methods.declaringClass - the declared classmethodsToFilter - (optional) the methods to be filteredListgetMethods(Class, boolean, boolean, Predicate[])static List<Method> getAllDeclaredMethods(Class<?> declaringClass, Predicate<Method>... methodsToFilter)
methods of the declared class, including the inherited methods.declaringClass - the declared classmethodsToFilter - (optional) the methods to be filteredListgetMethods(Class, boolean, boolean, Predicate[])static List<Method> getAllMethods(Class<?> declaringClass, Predicate<Method>... methodsToFilter)
methods of the declared class, including the inherited methods.declaringClass - the declared classmethodsToFilter - (optional) the methods to be filteredListgetMethods(Class, boolean, boolean, Predicate[])static Method findMethod(Class type, String methodName)
Method by the the specified type and method name without the parameter typestype - the target typemethodName - the specified method namenullstatic Method findMethod(Class type, String methodName, Class<?>... parameterTypes)
Method by the the specified type, method name and parameter typestype - the target typemethodName - the method nameparameterTypes - the parameter typesnullstatic <T> T invokeMethod(Object object, String methodName, Object... methodParameters)
T - the return typeobject - the target objectmethodName - the method namemethodParameters - the method parametersstatic boolean overrides(Method overrider, Method overridden)
overrider - the first method, possible overrideroverridden - the second method, possibly being overriddentrue if and only if the first method overrides
the secondElements.overrides(ExecutableElement, ExecutableElement, TypeElement)static Method findNearestOverriddenMethod(Method overrider)
method from the inherited classoverrider - the overrider methodmethod, or nullCopyright © 2011–2022 The Apache Software Foundation. All rights reserved.