org.springframework.security.util
Class FieldUtils

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

public final class FieldUtils
extends java.lang.Object

Offers static methods for directly manipulating static fields.


Method Summary
static java.lang.String getAccessorName(java.lang.String fieldName, java.lang.Class<?> type)
           
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.String getMutatorName(java.lang.String fieldName)
           
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)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getAccessorName

public static java.lang.String getAccessorName(java.lang.String fieldName,
                                               java.lang.Class<?> type)

getField

public static java.lang.reflect.Field getField(java.lang.Class<?> clazz,
                                               java.lang.String fieldName)
                                        throws java.lang.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:
java.lang.IllegalStateException - if field could not be found

getFieldValue

public static java.lang.Object getFieldValue(java.lang.Object bean,
                                             java.lang.String fieldName)
                                      throws java.lang.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:
java.lang.IllegalAccessException

getMutatorName

public static java.lang.String getMutatorName(java.lang.String fieldName)

getProtectedFieldValue

public static java.lang.Object getProtectedFieldValue(java.lang.String protectedField,
                                                      java.lang.Object object)

setProtectedFieldValue

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