public final class Methods extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static java.lang.reflect.Method |
findMethod(java.lang.Class<?> sourceClass,
java.lang.String name,
java.lang.Class<?>... types)
Helper method for
Class.getMethod(String, Class...) that returns null if the method does not exist. |
static java.lang.reflect.Method |
findMethod(java.lang.String className,
java.lang.String name,
java.lang.Class<?>... types)
Helper method for
Class.getMethod(String, Class...) that returns null if the class or method does not exist. |
static java.util.Set<java.lang.reflect.Method> |
findMethods(java.lang.Class<?> sourceClass,
java.lang.String... patterns)
Returns a set of methods for the specified class whose names match the specified regular expression patterns.
|
static java.lang.reflect.Method |
getMethod(java.lang.Class<?> sourceClass,
java.lang.String name,
java.lang.Class<?>... types)
Helper method for
Class.getMethod(String, Class...) where method is known to exist. |
static java.lang.Object |
invoke(java.lang.reflect.Method method,
java.lang.Object object,
java.lang.Object... parameters)
Helper method for
Method.invoke(Object, Object...) that performs the necessary exception handling. |
public static java.lang.Object invoke(java.lang.reflect.Method method, java.lang.Object object, java.lang.Object... parameters) throws java.sql.SQLException
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 parametersjava.sql.SQLException
- the target exception of the method invocationjava.lang.IllegalArgumentException
- if the the underlying method is inaccessiblepublic static java.util.Set<java.lang.reflect.Method> findMethods(java.lang.Class<?> sourceClass, java.lang.String... patterns)
sourceClass
- the class from which to find methodspatterns
- regular expression patternspublic static java.lang.reflect.Method getMethod(java.lang.Class<?> sourceClass, java.lang.String name, java.lang.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 typesjava.lang.IllegalArgumentException
- if no such method existspublic static java.lang.reflect.Method findMethod(java.lang.Class<?> sourceClass, java.lang.String name, java.lang.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 java.lang.reflect.Method findMethod(java.lang.String className, java.lang.String name, java.lang.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 types