public final class

FieldUtils

extends Object
java.lang.Object
   ↳ org.springframework.security.util.FieldUtils

Class Overview

Offers static methods for directly manipulating fields.

Summary

Public Constructors
FieldUtils()
Public Methods
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)
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public FieldUtils ()

Public Methods

public static Field getField (Class<?> clazz, String fieldName)

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

public static Object getFieldValue (Object bean, String fieldName)

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

public static Object getProtectedFieldValue (String protectedField, Object object)

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