Modifier and Type | Method and Description |
---|---|
static Method |
findMethod(Class<?> sourceClass,
String name,
Class<?>... types)
Helper method for
Class.getMethod(String, Class...) that returns null if the method does not exist. |
static Method |
findMethod(String className,
String name,
Class<?>... types)
Helper method for
Class.getMethod(String, Class...) that returns null if the class or method does not exist. |
static Set<Method> |
findMethods(Class<?> sourceClass,
String... patterns)
Returns a set of methods for the specified class whose names match the specified regular expression patterns.
|
static Method |
getMethod(Class<?> sourceClass,
String name,
Class<?>... types)
Helper method for
Class.getMethod(String, Class...) where method is known to exist. |
static <R,E extends Exception> |
invoke(Method method,
ExceptionFactory<E> factory,
Object object,
Object... parameters)
Helper method for
Method.invoke(Object, Object...) that performs the necessary exception handling. |
public static <R,E extends Exception> R invoke(Method method, ExceptionFactory<E> factory, Object object, Object... parameters) throws E extends Exception
Method.invoke(Object, Object...)
that performs the necessary exception handling.method
- a method to invokeobject
- the object on which to invoke the given methodparameters
- the method parametersSQLException
- the target exception of the method invocationIllegalArgumentException
- if the the underlying method is inaccessibleE extends Exception
public static Set<Method> findMethods(Class<?> sourceClass, String... patterns)
sourceClass
- the class from which to find methodspatterns
- regular expression patternspublic static Method getMethod(Class<?> sourceClass, String name, Class<?>... types)
Class.getMethod(String, Class...)
where method is known to exist.sourceClass
- the class from which to find methodsname
- the method nametypes
- the parameter typesIllegalArgumentException
- if no such method existspublic static Method findMethod(Class<?> sourceClass, String name, Class<?>... types)
Class.getMethod(String, Class...)
that returns null if the method does not exist.sourceClass
- the class from which to find methodsname
- the method nametypes
- the parameter typespublic static Method findMethod(String className, String name, Class<?>... types)
Class.getMethod(String, Class...)
that returns null if the class or method does not exist.className
- the name of the class containing the methodname
- the method nametypes
- the parameter typesCopyright © 2004–2014 Paul Ferraro. All rights reserved.