Class FieldUtils
java.lang.Object
org.springframework.security.util.FieldUtils
Offers static methods for directly manipulating fields.
-
Method Summary
Modifier and TypeMethodDescriptionstatic Field
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)
-
Method Details
-
getField
Attempts to locate the specified field on the class.- Parameters:
clazz
- the class definition containing the fieldfieldName
- the name of the field to locate- Returns:
- the Field (never null)
- Throws:
IllegalStateException
- if field could not be found
-
getFieldValue
Returns the value of a (nested) field on a bean. Intended for testing.- Parameters:
bean
- the objectfieldName
- the field name, with "." separating nested properties- Returns:
- the value of the nested field
- Throws:
IllegalAccessException
-
getProtectedFieldValue
-
setProtectedFieldValue
-