org.springframework.security.util
Class FieldUtils

java.lang.Object
  extended by org.springframework.security.util.FieldUtils

public final class FieldUtils
extends Object

Offers static methods for directly manipulating fields.


Constructor Summary
FieldUtils()
           
 
Method Summary
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)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FieldUtils

public FieldUtils()
Method Detail

getField

public static Field getField(Class<?> clazz,
                             String fieldName)
                      throws IllegalStateException
Attempts to locate the specified field on the class.

Parameters:
clazz - the class definition containing the field
fieldName - the name of the field to locate
Returns:
the Field (never null)
Throws:
IllegalStateException - if field could not be found

getFieldValue

public static Object getFieldValue(Object bean,
                                   String fieldName)
                            throws IllegalAccessException
Returns the value of a (nested) field on a bean. Intended for testing.

Parameters:
bean - the object
fieldName - the field name, with "." separating nested properties
Returns:
the value of the nested field
Throws:
IllegalAccessException

getProtectedFieldValue

public static Object getProtectedFieldValue(String protectedField,
                                            Object object)

setProtectedFieldValue

public static void setProtectedFieldValue(String protectedField,
                                          Object object,
                                          Object newValue)