org.codehaus.plexus.util
Class ReflectionUtils
java.lang.Object
org.codehaus.plexus.util.ReflectionUtils
public final class ReflectionUtils
extends java.lang.Object
$Id: ReflectionUtils.java 3086 2006-03-22 20:06:03Z jesse $
ReflectionUtils
private ReflectionUtils()
gatherVariablesAndValuesIncludingSuperclasses
private static void gatherVariablesAndValuesIncludingSuperclasses(Object object,
Map map)
throws IllegalAccessException
populates a map of the fields and values on a given object,
also pulls from superclasses
object
- the object to generate the list of fields frommap
- to populate
getFieldByNameIncludingSuperclasses
public static Field getFieldByNameIncludingSuperclasses(String fieldName,
Class clazz)
getSetter
public static Method getSetter(String fieldName,
Class clazz)
Finds a setter in the given class for the given field. It searches
interfaces and superclasses too.
fieldName
- the name of the field (i.e. 'fooBar'); it will
search for a method named 'setFooBar'.clazz
- The class to find the method in.
- null or the method found.
getValueIncludingSuperclasses
public static Object getValueIncludingSuperclasses(String variable,
Object object)
throws IllegalAccessException
Generates a map of the fields and values on a given object,
also pulls from superclasses
object
- the object to generate the list of fields from
- map containing the fields and their values
getVariablesAndValuesIncludingSuperclasses
public static Map getVariablesAndValuesIncludingSuperclasses(Object object)
throws IllegalAccessException
Generates a map of the fields and values on a given object,
also pulls from superclasses
object
- the object to generate the list of fields from
- map containing the fields and their values
setVariableValueInObject
public static void setVariableValueInObject(Object object,
String variable,
Object value)
throws IllegalAccessException
attempts to set the value to the variable in the object passed in
object
- variable
- value
-