public final class JReflectionUtils extends Object
| Modifier and Type | Method and Description |
|---|---|
static List<Field> |
getAllFields(List<Field> fields,
Class<?> clazz)
This static method will get ALL fields for this class, including any inherited ones.
|
static List<Method> |
getAllMethods(List<Method> methods,
Class<?> clazz)
This static method will get ALL methods for this class, including any inherited ones.
|
static Method |
getMethodByName(Class<?> clazz,
String name)
Retrieve a Method object with the provided name on the class, clazz.
|
static Object |
runGetter(Object object,
Field field)
Execute a "getter" on the provided object for the given field.
|
static Object |
runMethod(Object object,
String method,
Object... args)
Use reflection to run/execute the method represented by "method",
on the object
object, given the list of args. |
static Object |
runSetter(Object object,
String method,
Object arg,
Class<? extends Object> argClazz)
Execute a "setter" on the provided object for the given method name.
|
public static Object runGetter(Object object, Field field) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException
object - - The object to run the "getter" onfield - - The Field to retrieve data fromIllegalAccessExceptionIllegalArgumentExceptionInvocationTargetExceptionpublic static Object runSetter(Object object, String method, Object arg, Class<? extends Object> argClazz) throws JException
object - - The Object to run the "setter" methodmethod - - The "setter" method name as a stringarg - - The Object argument to setargClazz - - The Class type of the "setter" argumentJExceptionpublic static Object runMethod(Object object, String method, Object... args) throws JException
object, given the list of args.object - - The object to execute the method againstmethod - - The method nameargs - - All the arguments for this methodJExceptionpublic static List<Field> getAllFields(List<Field> fields, Class<?> clazz)
fields - List<Field> - a list to use to add toclazz - Class<?> - The Class to run the reflection onpublic static List<Method> getAllMethods(List<Method> methods, Class<?> clazz)
methods - List<Method>clazz - Class<?> - The Class to run the reflection onCopyright © 2014. All rights reserved.