public final class FieldUtils extends Object
Constructor and Description |
---|
FieldUtils() |
Modifier and Type | Method and Description |
---|---|
static Field |
getField(Class<?> clazz,
String fieldName)
Attempts to locate the specified field on the class.
|
static Object |
getFieldValue(Object bean,
String fieldName)
Returns the value of a (nested) field on a bean.
|
static Object |
getProtectedFieldValue(String protectedField,
Object object) |
static void |
setProtectedFieldValue(String protectedField,
Object object,
Object newValue) |
public static Field getField(Class<?> clazz, String fieldName) throws IllegalStateException
clazz
- the class definition containing the fieldfieldName
- the name of the field to locateIllegalStateException
- if field could not be foundpublic static Object getFieldValue(Object bean, String fieldName) throws IllegalAccessException
bean
- the objectfieldName
- the field name, with "." separating nested propertiesIllegalAccessException
public static Object getProtectedFieldValue(String protectedField, Object object)