public class

DirectFieldAccessor

extends AbstractPropertyAccessor
java.lang.Object
   ↳ org.springframework.beans.PropertyEditorRegistrySupport
     ↳ org.springframework.beans.AbstractPropertyAccessor
       ↳ org.springframework.beans.DirectFieldAccessor

Class Overview

PropertyAccessor implementation that directly accesses instance fields. Allows for direct binding to fields instead of going through JavaBean setters.

This implementation just supports fields in the actual target object. It is not able to traverse nested fields.

A DirectFieldAccessor's default for the "extractOldValueForEditor" setting is "true", since a field can always be read without side effects.

Summary

[Expand]
Inherited Constants
From interface org.springframework.beans.PropertyAccessor
Public Constructors
DirectFieldAccessor(Object target)
Create a new DirectFieldAccessor for the given target object.
Public Methods
<T> T convertIfNecessary(Object value, Class<T> requiredType, MethodParameter methodParam)
Class getPropertyType(String propertyName)
Determine the property type for the given property path.
TypeDescriptor getPropertyTypeDescriptor(String propertyName)
Object getPropertyValue(String propertyName)
Actually get the value of a property.
boolean isReadableProperty(String propertyName)
boolean isWritableProperty(String propertyName)
void setPropertyValue(String propertyName, Object newValue)
Actually set a property value.
[Expand]
Inherited Methods
From class org.springframework.beans.AbstractPropertyAccessor
From class org.springframework.beans.PropertyEditorRegistrySupport
From class java.lang.Object
From interface org.springframework.beans.ConfigurablePropertyAccessor
From interface org.springframework.beans.PropertyAccessor
From interface org.springframework.beans.PropertyEditorRegistry
From interface org.springframework.beans.TypeConverter

Public Constructors

public DirectFieldAccessor (Object target)

Also: SpringBeans

Create a new DirectFieldAccessor for the given target object.

Parameters
target the target object to access

Public Methods

public T convertIfNecessary (Object value, Class<T> requiredType, MethodParameter methodParam)

public Class getPropertyType (String propertyName)

Also: SpringBeans

Determine the property type for the given property path.

Called by findCustomEditor(Class, String) if no required type has been specified, to be able to find a type-specific editor even if just given a property path.

The default implementation always returns null. BeanWrapperImpl overrides this with the standard getPropertyType method as defined by the BeanWrapper interface.

Parameters
propertyName the property path to determine the type for
Returns
  • the type of the property, or null if not determinable

public TypeDescriptor getPropertyTypeDescriptor (String propertyName)

Also: SpringBeans

public Object getPropertyValue (String propertyName)

Also: SpringBeans

Actually get the value of a property.

Parameters
propertyName name of the property to get the value of
Returns
  • the value of the property

public boolean isReadableProperty (String propertyName)

Also: SpringBeans

public boolean isWritableProperty (String propertyName)

Also: SpringBeans

public void setPropertyValue (String propertyName, Object newValue)

Also: SpringBeans

Actually set a property value.

Parameters
propertyName name of the property to set value of
newValue the new value