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