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()
AbstractNestablePropertyAccessor.PropertyHandler, AbstractNestablePropertyAccessor.PropertyTokenHolder
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)
Create a new DirectFieldAccessor for the given object.
|
protected |
DirectFieldAccessor(java.lang.Object object,
java.lang.String nestedPath,
DirectFieldAccessor parent)
Create a new DirectFieldAccessor for the given object,
registering a nested path that the object is in.
|
Modifier and Type | Method and Description |
---|---|
protected NotWritablePropertyException |
createNotWritablePropertyException(java.lang.String propertyName)
Create a
NotWritablePropertyException for the specified property. |
protected org.springframework.beans.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, getFinalPath, 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
public DirectFieldAccessor(java.lang.Object object)
object
- object wrapped by this DirectFieldAccessorprotected DirectFieldAccessor(java.lang.Object object, java.lang.String nestedPath, DirectFieldAccessor parent)
object
- object wrapped by this DirectFieldAccessornestedPath
- the nested path of the objectparent
- the containing DirectFieldAccessor (must not be null
)protected org.springframework.beans.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