Class AbstractPropertyAccessor
- All Implemented Interfaces:
- ConfigurablePropertyAccessor, PropertyAccessor, PropertyEditorRegistry, TypeConverter
- Direct Known Subclasses:
- AbstractNestablePropertyAccessor
PropertyAccessor interface.
Provides base implementations of all convenience methods, with the
implementation of actual property access left to subclasses.- Since:
- 2.0
- Author:
- Juergen Hoeller, Stephane Nicoll
- See Also:
- 
Field SummaryFields inherited from interface PropertyAccessorNESTED_PROPERTY_SEPARATOR, NESTED_PROPERTY_SEPARATOR_CHAR, PROPERTY_KEY_PREFIX, PROPERTY_KEY_PREFIX_CHAR, PROPERTY_KEY_SUFFIX, PROPERTY_KEY_SUFFIX_CHAR
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptiongetPropertyType(String propertyPath) Determine the property type for the given property path.getPropertyValue(String propertyName) Actually get the value of a property.booleanReturn whether "auto-growing" of nested paths has been activated.booleanReturn whether to extract the old property value when applying a property editor to a new value for a property.voidsetAutoGrowNestedPaths(boolean autoGrowNestedPaths) Set whether this instance should attempt to "auto-grow" a nested path that contains anullvalue.voidsetExtractOldValueForEditor(boolean extractOldValueForEditor) Set whether to extract the old property value when applying a property editor to a new value for a property.abstract voidsetPropertyValue(String propertyName, @Nullable Object value) Actually set a property value.voidSet the specified value as current property value.voidsetPropertyValues(Map<?, ?> map) Perform a batch update from a Map.voidThe preferred way to perform a batch update.voidsetPropertyValues(PropertyValues pvs, boolean ignoreUnknown) Perform a batch update with more control over behavior.voidsetPropertyValues(PropertyValues pvs, boolean ignoreUnknown, boolean ignoreInvalid) Perform a batch update with full control over behavior.Methods inherited from class TypeConverterSupportconvertIfNecessary, convertIfNecessary, convertIfNecessary, convertIfNecessaryMethods inherited from class PropertyEditorRegistrySupportcopyCustomEditorsTo, copyDefaultEditorsTo, findCustomEditor, getConversionService, getDefaultEditor, guessPropertyTypeFromEditors, hasCustomEditorForElement, overrideDefaultEditor, registerCustomEditor, registerCustomEditor, registerDefaultEditors, setConversionService, setDefaultEditorRegistrar, useConfigValueEditorsMethods inherited from class Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ConfigurablePropertyAccessorgetConversionService, setConversionServiceMethods inherited from interface PropertyAccessorgetPropertyTypeDescriptor, isReadableProperty, isWritablePropertyMethods inherited from interface PropertyEditorRegistryfindCustomEditor, registerCustomEditor, registerCustomEditorMethods inherited from interface TypeConverterconvertIfNecessary, convertIfNecessary, convertIfNecessary, convertIfNecessary
- 
Constructor Details- 
AbstractPropertyAccessorpublic AbstractPropertyAccessor()
 
- 
- 
Method Details- 
setExtractOldValueForEditorpublic void setExtractOldValueForEditor(boolean extractOldValueForEditor) Description copied from interface:ConfigurablePropertyAccessorSet whether to extract the old property value when applying a property editor to a new value for a property.- Specified by:
- setExtractOldValueForEditorin interface- ConfigurablePropertyAccessor
 
- 
isExtractOldValueForEditorpublic boolean isExtractOldValueForEditor()Description copied from interface:ConfigurablePropertyAccessorReturn whether to extract the old property value when applying a property editor to a new value for a property.- Specified by:
- isExtractOldValueForEditorin interface- ConfigurablePropertyAccessor
 
- 
setAutoGrowNestedPathspublic void setAutoGrowNestedPaths(boolean autoGrowNestedPaths) Description copied from interface:ConfigurablePropertyAccessorSet whether this instance should attempt to "auto-grow" a nested path that contains anullvalue.If true, anullpath location will be populated with a default object value and traversed instead of resulting in aNullValueInNestedPathException.Default is falseon a plain PropertyAccessor instance.- Specified by:
- setAutoGrowNestedPathsin interface- ConfigurablePropertyAccessor
 
- 
isAutoGrowNestedPathspublic boolean isAutoGrowNestedPaths()Description copied from interface:ConfigurablePropertyAccessorReturn whether "auto-growing" of nested paths has been activated.- Specified by:
- isAutoGrowNestedPathsin interface- ConfigurablePropertyAccessor
 
- 
setPropertyValueDescription copied from interface:PropertyAccessorSet the specified value as current property value.- Specified by:
- setPropertyValuein interface- PropertyAccessor
- Parameters:
- pv- an object containing the new property value
- Throws:
- BeansException
 
- 
setPropertyValuesDescription copied from interface:PropertyAccessorPerform a batch update from a Map.Bulk updates from PropertyValues are more powerful: This method is provided for convenience. Behavior will be identical to that of the PropertyAccessor.setPropertyValues(PropertyValues)method.- Specified by:
- setPropertyValuesin interface- PropertyAccessor
- Parameters:
- map- a Map to take properties from. Contains property value objects, keyed by property name
- Throws:
- BeansException
 
- 
setPropertyValuesDescription copied from interface:PropertyAccessorThe preferred way to perform a batch update.Note that performing a batch update differs from performing a single update, in that an implementation of this class will continue to update properties if a recoverable error (such as a type mismatch, but not an invalid field name or the like) is encountered, throwing a PropertyBatchUpdateExceptioncontaining all the individual errors. This exception can be examined later to see all binding errors. Properties that were successfully updated remain changed.Does not allow unknown fields or invalid fields. - Specified by:
- setPropertyValuesin interface- PropertyAccessor
- Parameters:
- pvs- a PropertyValues to set on the target object
- Throws:
- BeansException
- See Also:
 
- 
setPropertyValuesDescription copied from interface:PropertyAccessorPerform a batch update with more control over behavior.Note that performing a batch update differs from performing a single update, in that an implementation of this class will continue to update properties if a recoverable error (such as a type mismatch, but not an invalid field name or the like) is encountered, throwing a PropertyBatchUpdateExceptioncontaining all the individual errors. This exception can be examined later to see all binding errors. Properties that were successfully updated remain changed.- Specified by:
- setPropertyValuesin interface- PropertyAccessor
- Parameters:
- pvs- a PropertyValues to set on the target object
- ignoreUnknown- should we ignore unknown properties (not found in the bean)
- Throws:
- BeansException
- See Also:
 
- 
setPropertyValuespublic void setPropertyValues(PropertyValues pvs, boolean ignoreUnknown, boolean ignoreInvalid) throws BeansException Description copied from interface:PropertyAccessorPerform a batch update with full control over behavior.Note that performing a batch update differs from performing a single update, in that an implementation of this class will continue to update properties if a recoverable error (such as a type mismatch, but not an invalid field name or the like) is encountered, throwing a PropertyBatchUpdateExceptioncontaining all the individual errors. This exception can be examined later to see all binding errors. Properties that were successfully updated remain changed.- Specified by:
- setPropertyValuesin interface- PropertyAccessor
- Parameters:
- pvs- a PropertyValues to set on the target object
- ignoreUnknown- should we ignore unknown properties (not found in the bean)
- ignoreInvalid- should we ignore invalid properties (found but not accessible)
- Throws:
- BeansException
 
- 
getPropertyTypeDescription copied from class:PropertyEditorRegistrySupportDetermine the property type for the given property path.Called by PropertyEditorRegistrySupport.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 standardgetPropertyTypemethod as defined by the BeanWrapper interface.- Specified by:
- getPropertyTypein interface- PropertyAccessor
- Overrides:
- getPropertyTypein class- PropertyEditorRegistrySupport
- Parameters:
- propertyPath- the property path to determine the type for
- Returns:
- the type of the property, or nullif not determinable
- See Also:
 
- 
getPropertyValueActually get the value of a property.- Specified by:
- getPropertyValuein interface- PropertyAccessor
- Parameters:
- propertyName- name of the property to get the value of
- Returns:
- the value of the property
- Throws:
- InvalidPropertyException- if there is no such property or if the property isn't readable
- PropertyAccessException- if the property was valid but the accessor method failed
- BeansException
 
- 
setPropertyValuepublic abstract void setPropertyValue(String propertyName, @Nullable Object value) throws BeansException Actually set a property value.- Specified by:
- setPropertyValuein interface- PropertyAccessor
- Parameters:
- propertyName- name of the property to set value of
- value- the new value
- Throws:
- InvalidPropertyException- if there is no such property or if the property isn't writable
- PropertyAccessException- if the property was valid but the accessor method failed or a type mismatch occurred
- BeansException
 
 
-