Package org.springframework.beans
Class DirectFieldAccessor
- All Implemented Interfaces:
- ConfigurablePropertyAccessor,- PropertyAccessor,- PropertyEditorRegistry,- TypeConverter
ConfigurablePropertyAccessor implementation that directly accesses
 instance fields. Allows for direct binding to fields instead of going through
 JavaBean setters.
 As of Spring 4.2, the vast majority of the BeanWrapper features have
 been merged to AbstractPropertyAccessor, which means that property
 traversal as well as collections and map access is now supported here as well.
 
A DirectFieldAccessor's default for the "extractOldValueForEditor" setting is "true", since a field can always be read without side effects.
- Since:
- 2.0
- Author:
- Juergen Hoeller, Stephane Nicoll
- See Also:
- 
Nested Class SummaryNested classes/interfaces inherited from class org.springframework.beans.AbstractNestablePropertyAccessorAbstractNestablePropertyAccessor.PropertyHandler, AbstractNestablePropertyAccessor.PropertyTokenHolder
- 
Field SummaryFields inherited from interface org.springframework.beans.PropertyAccessorNESTED_PROPERTY_SEPARATOR, NESTED_PROPERTY_SEPARATOR_CHAR, PROPERTY_KEY_PREFIX, PROPERTY_KEY_PREFIX_CHAR, PROPERTY_KEY_SUFFIX, PROPERTY_KEY_SUFFIX_CHAR
- 
Constructor SummaryConstructorsModifierConstructorDescriptionDirectFieldAccessor(Object object) Create a new DirectFieldAccessor for the given object.protectedDirectFieldAccessor(Object object, String nestedPath, DirectFieldAccessor parent) Create a new DirectFieldAccessor for the given object, registering a nested path that the object is in.
- 
Method SummaryModifier and TypeMethodDescriptionprotected NotWritablePropertyExceptioncreateNotWritablePropertyException(String propertyName) Create aNotWritablePropertyExceptionfor the specified property.protected org.springframework.beans.DirectFieldAccessor.FieldPropertyHandlergetLocalPropertyHandler(String propertyName) Return aAbstractNestablePropertyAccessor.PropertyHandlerfor the specified localpropertyName.protected DirectFieldAccessornewNestedPropertyAccessor(Object object, String nestedPath) Create a new nested property accessor instance.Methods inherited from class org.springframework.beans.AbstractNestablePropertyAccessorconvertForProperty, getAutoGrowCollectionLimit, getFinalPath, getNestedPath, getPropertyAccessorForPropertyPath, getPropertyHandler, getPropertyType, getPropertyTypeDescriptor, getPropertyValue, getPropertyValue, getRootClass, getRootInstance, getWrappedClass, getWrappedInstance, isReadableProperty, isWritableProperty, setAutoGrowCollectionLimit, setPropertyValue, setPropertyValue, setPropertyValue, setWrappedInstance, setWrappedInstance, toStringMethods inherited from class org.springframework.beans.AbstractPropertyAccessorisAutoGrowNestedPaths, isExtractOldValueForEditor, setAutoGrowNestedPaths, setExtractOldValueForEditor, setPropertyValues, setPropertyValues, setPropertyValues, setPropertyValuesMethods inherited from class org.springframework.beans.TypeConverterSupportconvertIfNecessary, convertIfNecessary, convertIfNecessary, convertIfNecessaryMethods inherited from class org.springframework.beans.PropertyEditorRegistrySupportcopyCustomEditorsTo, copyDefaultEditorsTo, findCustomEditor, getConversionService, getDefaultEditor, guessPropertyTypeFromEditors, hasCustomEditorForElement, overrideDefaultEditor, registerCustomEditor, registerCustomEditor, registerDefaultEditors, setConversionService, useConfigValueEditorsMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.springframework.beans.ConfigurablePropertyAccessorgetConversionService, setConversionServiceMethods inherited from interface org.springframework.beans.PropertyEditorRegistryfindCustomEditor, registerCustomEditor, registerCustomEditorMethods inherited from interface org.springframework.beans.TypeConverterconvertIfNecessary, convertIfNecessary, convertIfNecessary, convertIfNecessary
- 
Constructor Details- 
DirectFieldAccessorCreate a new DirectFieldAccessor for the given object.- Parameters:
- object- the object wrapped by this DirectFieldAccessor
 
- 
DirectFieldAccessorCreate a new DirectFieldAccessor for the given object, registering a nested path that the object is in.- Parameters:
- object- the object wrapped by this DirectFieldAccessor
- nestedPath- the nested path of the object
- parent- the containing DirectFieldAccessor (must not be- null)
 
 
- 
- 
Method Details- 
getLocalPropertyHandler@Nullable protected org.springframework.beans.DirectFieldAccessor.FieldPropertyHandler getLocalPropertyHandler(String propertyName) Description copied from class:AbstractNestablePropertyAccessorReturn aAbstractNestablePropertyAccessor.PropertyHandlerfor the specified localpropertyName. Only used to reach a property available in the current context.- Specified by:
- getLocalPropertyHandlerin class- AbstractNestablePropertyAccessor
- Parameters:
- propertyName- the name of a local property
- Returns:
- the handler for that property, or nullif it has not been found
 
- 
newNestedPropertyAccessorDescription copied from class:AbstractNestablePropertyAccessorCreate a new nested property accessor instance. Can be overridden in subclasses to create a PropertyAccessor subclass.- Specified by:
- newNestedPropertyAccessorin class- AbstractNestablePropertyAccessor
- Parameters:
- object- the object wrapped by this PropertyAccessor
- nestedPath- the nested path of the object
- Returns:
- the nested PropertyAccessor instance
 
- 
createNotWritablePropertyExceptionDescription copied from class:AbstractNestablePropertyAccessorCreate aNotWritablePropertyExceptionfor the specified property.- Specified by:
- createNotWritablePropertyExceptionin class- AbstractNestablePropertyAccessor
 
 
-