| java.lang.Object com.anthonyeden.lib.util.MethodUtilities
MethodUtilities | public class MethodUtilities (Code) | | Utilities for invoking methods at runtime using reflection.
author: Anthony Eden |
Method Summary | |
public static Method | getDeclaredMethod(Class targetClass, String name, Class paramClass) Get the declared method with the given name and with a single argument
of the type specified by paramClass. | public static Method | getDeclaredMethod(Class targetClass, String name, Class[] paramClasses) Get the declared method with the given name and with arguments of
the types specified by paramClasses. | public static Method | getMethod(Class targetClass, String name, Class paramClass) Get the method with the given name and with a single argument of the
type specified by paramClass. | public static Method | getMethod(Class targetClass, String name, Class[] paramClasses) Get the method with the given name and with arguments of the
types specified by paramClasses. | public static Object | invoke(Method method, Object target, Object arg) Invoke the given method. | public static Object | invoke(Method method, Object target, Object[] args) Invoke the given method. | public static Object | invoke(String methodName, Object target, Object arg) Invoke the given method. | public static Object | invoke(String methodName, Object target, Object[] args) Invoke the given method. | public static Object | invoke(String methodName, Object target, Class targetClass, Object[] args) Invoke the given method. | public static Object | invoke(String methodName, Object target, Class targetClass, Object arg) Invoke the given method. | public static Object | invokeDeclared(String methodName, Object target, Object arg) Invoke the given method. | public static Object | invokeDeclared(String methodName, Object target, Object[] args) Invoke the given method. |
getDeclaredMethod | public static Method getDeclaredMethod(Class targetClass, String name, Class paramClass) throws NoSuchMethodException, SecurityException(Code) | | Get the declared method with the given name and with a single argument
of the type specified by paramClass. The paramClass may be null in
which case the method should have no arguments.
Parameters: targetClass - The target class Parameters: name - The method name Parameters: paramClass - The single parameter class (may be null) The declared Method throws: SecurityException - throws: NoSuchMethodException - |
getMethod | public static Method getMethod(Class targetClass, String name, Class paramClass) throws NoSuchMethodException, SecurityException(Code) | | Get the method with the given name and with a single argument of the
type specified by paramClass. The paramClass may be null in which case
the method should have no arguments.
Parameters: targetClass - The target class Parameters: name - The method name Parameters: paramClass - The single parameter class (may be null) The Method throws: SecurityException - throws: NoSuchMethodException - |
getMethod | public static Method getMethod(Class targetClass, String name, Class[] paramClasses) throws NoSuchMethodException, SecurityException(Code) | | Get the method with the given name and with arguments of the
types specified by paramClasses. If the method is not found
then a method which accepts superclasses of the current arguments
will be returned, if possible.
Parameters: targetClass - The target class Parameters: name - The method name Parameters: paramClasses - An array of parameter classes The Method throws: SecurityException - throws: NoSuchMethodException - |
|
|