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(Object object)
Create a new DirectFieldAccessor for the given object.
|
protected |
DirectFieldAccessor(Object object,
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(String propertyName)
Create a
NotWritablePropertyException for the specified property. |
protected org.springframework.beans.DirectFieldAccessor.FieldPropertyHandler |
getLocalPropertyHandler(String propertyName)
Return a
AbstractNestablePropertyAccessor.PropertyHandler for the specified local propertyName . |
protected DirectFieldAccessor |
newNestedPropertyAccessor(Object object,
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(Object object)
object
- the object wrapped by this DirectFieldAccessorprotected DirectFieldAccessor(Object object, String nestedPath, DirectFieldAccessor parent)
object
- the object wrapped by this DirectFieldAccessornestedPath
- the nested path of the objectparent
- the containing DirectFieldAccessor (must not be null
)@Nullable protected org.springframework.beans.DirectFieldAccessor.FieldPropertyHandler getLocalPropertyHandler(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(Object object, String nestedPath)
AbstractNestablePropertyAccessor
newNestedPropertyAccessor
in class AbstractNestablePropertyAccessor
object
- object wrapped by this PropertyAccessornestedPath
- the nested path of the objectprotected NotWritablePropertyException createNotWritablePropertyException(String propertyName)
AbstractNestablePropertyAccessor
NotWritablePropertyException
for the specified property.createNotWritablePropertyException
in class AbstractNestablePropertyAccessor