public class Methods extends Object
| Modifier and Type | Method and Description |
|---|---|
static List<Method> |
getAllDeclaredMethodsOptional(Class<?> type)
Returns an unmodifiable list containing all methods of that are returned
by a call to
Class.getDeclaredMethods() on the given type or any
of its supertypes or its implemented interfaces. |
static List<Method> |
getAllDeclaredMethodsUnchecked(Class<?> type)
Returns an unmodifiable list containing all methods of that are returned
by a call to
Class.getDeclaredMethods() on the given type or any
of its supertypes or its implemented interfaces. |
static List<Method> |
getAllMethodsOptional(Class<?> type)
Returns an unmodifiable list containing all methods of that are returned
by a call to
Class.getMethods() on the given type or any
of its supertypes or its implemented interfaces. |
static List<Method> |
getAllMethodsUnchecked(Class<?> type)
Returns an unmodifiable list containing all methods of that are returned
by a call to
Class.getMethods() on the given type or any
of its supertypes or its implemented interfaces. |
static List<Method> |
getAllOptional(Class<?> type,
Predicate<? super Method>... predicates)
Returns an unmodifiable list containing all methods of the given type
that match the given predicates.
|
static List<Method> |
getAllUnchecked(Class<?> type,
Predicate<? super Method>... predicates)
Returns an unmodifiable list containing all methods of the given type
that match the given predicates.
|
static Method |
getDeclaredMethodOptional(Class<?> type,
String methodName,
Class<?>... parameterTypes)
Delegates to
Class.getDeclaredMethod(String, Class...). |
static List<Method> |
getDeclaredMethodsOptional(Class<?> type)
Delegates to
Class.getDeclaredMethods(), and returns the result
as an unmodifiable list. |
static List<Method> |
getDeclaredMethodsUnchecked(Class<?> type)
Delegates to
Class.getDeclaredMethods(), and returns the result
as an unmodifiable list. |
static Method |
getDeclaredMethodUnchecked(Class<?> type,
String methodName,
Class<?>... parameterTypes)
Delegates to
Class.getDeclaredMethod(String, Class...). |
static Method |
getMethodOptional(Class<?> type,
String methodName,
Class<?>... parameterTypes)
Delegates to
Class.getMethod(String, Class...). |
static List<Method> |
getMethodsOptional(Class<?> type)
Delegates to
Class.getMethods(), and returns the result
as an unmodifiable list. |
static List<Method> |
getMethodsUnchecked(Class<?> type)
Delegates to
Class.getMethods(), and returns the result
as an unmodifiable list. |
static Method |
getMethodUnchecked(Class<?> type,
String methodName,
Class<?>... parameterTypes)
Delegates to
Class.getMethod(String, Class...). |
static List<Method> |
getOwnDeclaredMethodsOptional(Class<?> type)
Returns an unmodifiable list containing all methods of that are returned
by a call to
Class.getDeclaredMethods() on the given type,
except for those that are inherited from any supertype or one of its
implemented interfaces. |
static List<Method> |
getOwnDeclaredMethodsUnchecked(Class<?> type)
Returns an unmodifiable list containing all methods of that are returned
by a call to
Class.getDeclaredMethods() on the given type,
except for those that are inherited from any supertype or one of its
implemented interfaces. |
static List<Method> |
getOwnMethodsOptional(Class<?> type)
Returns an unmodifiable list containing all methods of that are returned
by a call to
Class.getMethods() on the given type, except for
those that are inherited from any supertype or one of its implemented
interfaces. |
static List<Method> |
getOwnMethodsUnchecked(Class<?> type)
Returns an unmodifiable list containing all methods of that are returned
by a call to
Class.getMethods() on the given type, except for
those that are inherited from any supertype or one of its implemented
interfaces. |
static Object |
invokeNonAccessibleOptional(Method method,
Object object,
Object... arguments)
Delegates to
Method.invoke(Object, Object...). |
static Object |
invokeNonAccessibleUnchecked(Method method,
Object object,
Object... arguments)
Delegates to
Method.invoke(Object, Object...). |
static Object |
invokeOptional(Method method,
Object object,
Object... arguments)
Delegates to
Method.invoke(Object, Object...). |
static Object |
invokeUnchecked(Method method,
Object object,
Object... arguments)
Delegates to
Method.invoke(Object, Object...). |
static Method |
parseMethodUnchecked(String fullMethodString)
Parse the method from the given string.
|
public static Method parseMethodUnchecked(String fullMethodString)
Method.toString() or Method.toGenericString().fullMethodString - The full method stringReflectionException - If the method can not be parsed
for any reason. Either because the declaring class or any parameter
class can not be found, or because the method is not found, or
because the input string is otherwise invalid.public static Method getMethodUnchecked(Class<?> type, String methodName, Class<?>... parameterTypes)
Class.getMethod(String, Class...).ReflectionExceptiontype - The typemethodName - The method nameparameterTypes - The parameter typesReflectionException - if the the method could not be obtainedpublic static Method getMethodOptional(Class<?> type, String methodName, Class<?>... parameterTypes)
Class.getMethod(String, Class...).null if the underlying call did not succeed.type - The typemethodName - The method nameparameterTypes - The parameter typesnull if it could not be obtainedpublic static Method getDeclaredMethodUnchecked(Class<?> type, String methodName, Class<?>... parameterTypes)
Class.getDeclaredMethod(String, Class...).ReflectionExceptiontype - The typemethodName - The method nameparameterTypes - The parameter typesReflectionException - if the method could not be obtainedpublic static Method getDeclaredMethodOptional(Class<?> type, String methodName, Class<?>... parameterTypes)
Class.getDeclaredMethod(String, Class...).null if the underlying call did not succeed.type - The typemethodName - The method nameparameterTypes - The parameter typesnull if it could not be obtainedpublic static List<Method> getMethodsUnchecked(Class<?> type)
Class.getMethods(), and returns the result
as an unmodifiable list.ReflectionExceptiontype - The typeReflectionException - if the call did not succeedpublic static List<Method> getMethodsOptional(Class<?> type)
Class.getMethods(), and returns the result
as an unmodifiable list.type - The typepublic static List<Method> getDeclaredMethodsUnchecked(Class<?> type)
Class.getDeclaredMethods(), and returns the result
as an unmodifiable list.ReflectionExceptiontype - The typeReflectionException - if the call did not succeedpublic static List<Method> getDeclaredMethodsOptional(Class<?> type)
Class.getDeclaredMethods(), and returns the result
as an unmodifiable list.type - The typepublic static List<Method> getAllMethodsUnchecked(Class<?> type)
Class.getMethods() on the given type or any
of its supertypes or its implemented interfaces.ReflectionExceptiontype - The typeReflectionException - if the call did not succeed.public static List<Method> getAllMethodsOptional(Class<?> type)
Class.getMethods() on the given type or any
of its supertypes or its implemented interfaces.type - The typepublic static List<Method> getAllDeclaredMethodsUnchecked(Class<?> type)
Class.getDeclaredMethods() on the given type or any
of its supertypes or its implemented interfaces.ReflectionExceptiontype - The typeReflectionException - if the call did not succeed.public static List<Method> getAllDeclaredMethodsOptional(Class<?> type)
Class.getDeclaredMethods() on the given type or any
of its supertypes or its implemented interfaces.type - The typepublic static List<Method> getOwnMethodsUnchecked(Class<?> type)
Class.getMethods() on the given type, except for
those that are inherited from any supertype or one of its implemented
interfaces.ReflectionExceptiontype - The typeReflectionException - if the call did not succeed.public static List<Method> getOwnMethodsOptional(Class<?> type)
Class.getMethods() on the given type, except for
those that are inherited from any supertype or one of its implemented
interfaces.type - The typepublic static List<Method> getOwnDeclaredMethodsUnchecked(Class<?> type)
Class.getDeclaredMethods() on the given type,
except for those that are inherited from any supertype or one of its
implemented interfaces.ReflectionExceptiontype - The typeReflectionException - if the call did not succeed.public static List<Method> getOwnDeclaredMethodsOptional(Class<?> type)
Class.getDeclaredMethods() on the given type,
except for those that are inherited from any supertype or one of its
implemented interfaces.type - The type@SafeVarargs public static List<Method> getAllOptional(Class<?> type, Predicate<? super Method>... predicates)
getAllDeclaredMethodsOptional(Class) with the given
predicates.type - The typepredicates - The predicates@SafeVarargs public static List<Method> getAllUnchecked(Class<?> type, Predicate<? super Method>... predicates)
getAllDeclaredMethodsUnchecked(Class) with the given
predicates.ReflectionExceptiontype - The typepredicates - The predicatesReflectionException - if the call did not succeedpublic static Object invokeUnchecked(Method method, Object object, Object... arguments)
Method.invoke(Object, Object...).ReflectionExceptionmethod - The methodobject - The objectarguments - The argumentsReflectionException - if the call did not succeedpublic static Object invokeOptional(Method method, Object object, Object... arguments)
Method.invoke(Object, Object...).null will be returned in this case.method - The methodobject - The objectarguments - The argumentspublic static Object invokeNonAccessibleUnchecked(Method method, Object object, Object... arguments)
Method.invoke(Object, Object...). ReflectionExceptionmethod - The methodobject - The objectarguments - The argumentsReflectionException - if the call did not succeedpublic static Object invokeNonAccessibleOptional(Method method, Object object, Object... arguments)
Method.invoke(Object, Object...). null will be returned in this case.method - The methodobject - The objectarguments - The argumentsCopyright © 2018. All rights reserved.