public class DirectFieldAccessor extends AbstractNestablePropertyAccessor
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.
AbstractPropertyAccessor.setExtractOldValueForEditor(boolean)
,
BeanWrapper
,
DirectFieldBindingResult
,
DataBinder.initDirectFieldAccess()
Modifier and Type | Class and Description |
---|---|
private class |
DirectFieldAccessor.FieldPropertyHandler |
AbstractNestablePropertyAccessor.PropertyHandler, AbstractNestablePropertyAccessor.PropertyTokenHolder
Modifier and Type | Field and Description |
---|---|
private java.util.Map<java.lang.String,DirectFieldAccessor.FieldPropertyHandler> |
fieldMap |
typeConverterDelegate
NESTED_PROPERTY_SEPARATOR, NESTED_PROPERTY_SEPARATOR_CHAR, PROPERTY_KEY_PREFIX, PROPERTY_KEY_PREFIX_CHAR, PROPERTY_KEY_SUFFIX, PROPERTY_KEY_SUFFIX_CHAR
Modifier | Constructor and Description |
---|---|
|
DirectFieldAccessor(java.lang.Object object) |
protected |
DirectFieldAccessor(java.lang.Object object,
java.lang.String nestedPath,
DirectFieldAccessor superBw) |
Modifier and Type | Method and Description |
---|---|
protected NotWritablePropertyException |
createNotWritablePropertyException(java.lang.String propertyName)
Create a
NotWritablePropertyException for the specified property. |
protected DirectFieldAccessor.FieldPropertyHandler |
getLocalPropertyHandler(java.lang.String propertyName)
Return a
AbstractNestablePropertyAccessor.PropertyHandler for the specified local propertyName . |
protected DirectFieldAccessor |
newNestedPropertyAccessor(java.lang.Object object,
java.lang.String nestedPath)
Create a new nested property accessor instance.
|
convertForProperty, getAutoGrowCollectionLimit, getNestedPath, getPropertyAccessorForPropertyPath, getPropertyHandler, getPropertyType, getPropertyTypeDescriptor, getPropertyValue, getPropertyValue, getRootClass, getRootInstance, getWrappedClass, getWrappedInstance, isReadableProperty, isWritableProperty, setAutoGrowCollectionLimit, setPropertyValue, setPropertyValue, setPropertyValue, setWrappedInstance, setWrappedInstance, toString
isAutoGrowNestedPaths, isExtractOldValueForEditor, setAutoGrowNestedPaths, setExtractOldValueForEditor, setPropertyValues, setPropertyValues, setPropertyValues, setPropertyValues
convertIfNecessary, convertIfNecessary, convertIfNecessary
copyCustomEditorsTo, copyDefaultEditorsTo, findCustomEditor, getConversionService, getDefaultEditor, guessPropertyTypeFromEditors, hasCustomEditorForElement, overrideDefaultEditor, registerCustomEditor, registerCustomEditor, registerDefaultEditors, setConversionService, useConfigValueEditors
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getConversionService, setConversionService
findCustomEditor, registerCustomEditor, registerCustomEditor
convertIfNecessary, convertIfNecessary, convertIfNecessary
private final java.util.Map<java.lang.String,DirectFieldAccessor.FieldPropertyHandler> fieldMap
public DirectFieldAccessor(java.lang.Object object)
protected DirectFieldAccessor(java.lang.Object object, java.lang.String nestedPath, DirectFieldAccessor superBw)
protected DirectFieldAccessor.FieldPropertyHandler getLocalPropertyHandler(java.lang.String propertyName)
AbstractNestablePropertyAccessor
AbstractNestablePropertyAccessor.PropertyHandler
for the specified local propertyName
. Only
used to reach a property available in the current context.getLocalPropertyHandler
in class AbstractNestablePropertyAccessor
propertyName
- the name of a local propertynull
if it has not been foundprotected DirectFieldAccessor newNestedPropertyAccessor(java.lang.Object object, java.lang.String nestedPath)
AbstractNestablePropertyAccessor
newNestedPropertyAccessor
in class AbstractNestablePropertyAccessor
object
- object wrapped by this PropertyAccessornestedPath
- the nested path of the objectprotected NotWritablePropertyException createNotWritablePropertyException(java.lang.String propertyName)
AbstractNestablePropertyAccessor
NotWritablePropertyException
for the specified property.createNotWritablePropertyException
in class AbstractNestablePropertyAccessor