public class ReflectionUtils extends Object
| Constructor and Description |
|---|
ReflectionUtils() |
| Modifier and Type | Method and Description |
|---|---|
static List<Field> |
getDeclaredFields(Class clazz)
Returns the result of running
Class.getDeclaredFields() on the
supplied class, as well as all its super types. |
static Object |
getFieldValue(Field field,
Object object)
Gets the value of the
field for the given object. |
static void |
setFieldValue(Field field,
Object object,
Object value)
Sets the value of the
field for the given object. |
public static Object getFieldValue(Field field, Object object)
field for the given object. It will change the accessibility of the field if necessary.
Setting it back to its original value at the end of the method call.field - the field to read fromobject - the object to read the field frompublic static void setFieldValue(Field field, Object object, Object value)
field for the given object. It will change the accessibility of the field if necessary.
Setting it back to its original value at the end of the method call.field - the field to set the value ofobject - the object to for which to set the field value.value - the new value to be set to the field of object.public static List<Field> getDeclaredFields(Class clazz)
Class.getDeclaredFields() on the
supplied class, as well as all its super types. Fields are ordered in
ascending hierarchy order (subclasses first).clazz - Copyright © 2014 Atlassian. All rights reserved.