|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.beans.PropertyEditorRegistrySupport org.springframework.beans.AbstractPropertyAccessor
public abstract class AbstractPropertyAccessor
Abstract implementation of the PropertyAccessor
interface.
Provides base implementations of all convenience methods, with the
implementation of actual property access left to subclasses.
getPropertyValue(java.lang.String)
,
setPropertyValue(org.springframework.beans.PropertyValue)
Field Summary |
---|
Fields inherited from interface org.springframework.beans.PropertyAccessor |
---|
NESTED_PROPERTY_SEPARATOR, NESTED_PROPERTY_SEPARATOR_CHAR, PROPERTY_KEY_PREFIX, PROPERTY_KEY_PREFIX_CHAR, PROPERTY_KEY_SUFFIX, PROPERTY_KEY_SUFFIX_CHAR |
Constructor Summary | |
---|---|
AbstractPropertyAccessor()
|
Method Summary | ||
---|---|---|
|
convertIfNecessary(Object value,
Class<T> requiredType)
Convert the value to the required type (if necessary from a String). |
|
Class |
getPropertyType(String propertyPath)
Determine the property type for the given property path. |
|
abstract Object |
getPropertyValue(String propertyName)
Actually get the value of a property. |
|
boolean |
isExtractOldValueForEditor()
Return whether to extract the old property value when applying a property editor to a new value for a property. |
|
void |
setExtractOldValueForEditor(boolean extractOldValueForEditor)
Set whether to extract the old property value when applying a property editor to a new value for a property. |
|
void |
setPropertyValue(PropertyValue pv)
Set the specified value as current property value. |
|
abstract void |
setPropertyValue(String propertyName,
Object value)
Actually set a property value. |
|
void |
setPropertyValues(Map<?,?> map)
Perform a batch update from a Map. |
|
void |
setPropertyValues(PropertyValues pvs)
The preferred way to perform a batch update. |
|
void |
setPropertyValues(PropertyValues pvs,
boolean ignoreUnknown)
Perform a batch update with more control over behavior. |
|
void |
setPropertyValues(PropertyValues pvs,
boolean ignoreUnknown,
boolean ignoreInvalid)
Perform a batch update with full control over behavior. |
Methods inherited from class org.springframework.beans.PropertyEditorRegistrySupport |
---|
copyCustomEditorsTo, copyDefaultEditorsTo, findCustomEditor, getConversionService, getDefaultEditor, guessPropertyTypeFromEditors, hasCustomEditorForElement, isSharedEditor, overrideDefaultEditor, registerCustomEditor, registerCustomEditor, registerDefaultEditors, registerSharedEditor, setConversionService, useConfigValueEditors |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.springframework.beans.ConfigurablePropertyAccessor |
---|
getConversionService, setConversionService |
Methods inherited from interface org.springframework.beans.PropertyAccessor |
---|
getPropertyTypeDescriptor, isReadableProperty, isWritableProperty |
Methods inherited from interface org.springframework.beans.PropertyEditorRegistry |
---|
findCustomEditor, registerCustomEditor, registerCustomEditor |
Methods inherited from interface org.springframework.beans.TypeConverter |
---|
convertIfNecessary |
Constructor Detail |
---|
public AbstractPropertyAccessor()
Method Detail |
---|
public void setExtractOldValueForEditor(boolean extractOldValueForEditor)
ConfigurablePropertyAccessor
setExtractOldValueForEditor
in interface ConfigurablePropertyAccessor
public boolean isExtractOldValueForEditor()
ConfigurablePropertyAccessor
isExtractOldValueForEditor
in interface ConfigurablePropertyAccessor
public void setPropertyValue(PropertyValue pv) throws BeansException
PropertyAccessor
setPropertyValue
in interface PropertyAccessor
pv
- an object containing the new property value
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 occured
BeansException
public void setPropertyValues(Map<?,?> map) throws BeansException
PropertyAccessor
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.
setPropertyValues
in interface PropertyAccessor
map
- Map to take properties from. Contains property value objects,
keyed by property name
InvalidPropertyException
- if there is no such property or
if the property isn't writable
PropertyBatchUpdateException
- if one or more PropertyAccessExceptions
occured for specific properties during the batch update. This exception bundles
all individual PropertyAccessExceptions. All other properties will have been
successfully updated.
BeansException
public void setPropertyValues(PropertyValues pvs) throws BeansException
PropertyAccessor
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
PropertyBatchUpdateException
containing 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.
setPropertyValues
in interface PropertyAccessor
pvs
- PropertyValues to set on the target object
InvalidPropertyException
- if there is no such property or
if the property isn't writable
PropertyBatchUpdateException
- if one or more PropertyAccessExceptions
occured for specific properties during the batch update. This exception bundles
all individual PropertyAccessExceptions. All other properties will have been
successfully updated.
BeansException
PropertyAccessor.setPropertyValues(PropertyValues, boolean, boolean)
public void setPropertyValues(PropertyValues pvs, boolean ignoreUnknown) throws BeansException
PropertyAccessor
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
PropertyBatchUpdateException
containing all the individual errors.
This exception can be examined later to see all binding errors.
Properties that were successfully updated remain changed.
setPropertyValues
in interface PropertyAccessor
pvs
- PropertyValues to set on the target objectignoreUnknown
- should we ignore unknown properties (not found in the bean)
InvalidPropertyException
- if there is no such property or
if the property isn't writable
PropertyBatchUpdateException
- if one or more PropertyAccessExceptions
occured for specific properties during the batch update. This exception bundles
all individual PropertyAccessExceptions. All other properties will have been
successfully updated.
BeansException
PropertyAccessor.setPropertyValues(PropertyValues, boolean, boolean)
public void setPropertyValues(PropertyValues pvs, boolean ignoreUnknown, boolean ignoreInvalid) throws BeansException
PropertyAccessor
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
PropertyBatchUpdateException
containing all the individual errors.
This exception can be examined later to see all binding errors.
Properties that were successfully updated remain changed.
setPropertyValues
in interface PropertyAccessor
pvs
- PropertyValues to set on the target objectignoreUnknown
- should we ignore unknown properties (not found in the bean)ignoreInvalid
- should we ignore invalid properties (found but not accessible)
InvalidPropertyException
- if there is no such property or
if the property isn't writable
PropertyBatchUpdateException
- if one or more PropertyAccessExceptions
occured for specific properties during the batch update. This exception bundles
all individual PropertyAccessExceptions. All other properties will have been
successfully updated.
BeansException
public <T> T convertIfNecessary(Object value, Class<T> requiredType) throws TypeMismatchException
TypeConverter
Conversions from String to any type will typically use the setAsText
method of the PropertyEditor class. Note that a PropertyEditor must be registered
for the given class for this to work; this is a standard JavaBeans API.
A number of PropertyEditors are automatically registered.
convertIfNecessary
in interface TypeConverter
value
- the value to convertrequiredType
- the type we must convert to
(or null
if not known, for example in case of a collection element)
TypeMismatchException
- if type conversion failedPropertyEditor.setAsText(String)
,
PropertyEditor.getValue()
public Class getPropertyType(String propertyPath)
PropertyEditorRegistrySupport
Called by PropertyEditorRegistrySupport.findCustomEditor(java.lang.Class, java.lang.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 standard getPropertyType
method as defined by the BeanWrapper interface.
getPropertyType
in interface PropertyAccessor
getPropertyType
in class PropertyEditorRegistrySupport
propertyPath
- the property path to determine the type for
null
if not determinablePropertyAccessor.getPropertyType(String)
public abstract Object getPropertyValue(String propertyName) throws BeansException
getPropertyValue
in interface PropertyAccessor
propertyName
- name of the property to get the value of
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
public abstract void setPropertyValue(String propertyName, Object value) throws BeansException
setPropertyValue
in interface PropertyAccessor
propertyName
- name of the property to set value ofvalue
- the new value
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 occured
BeansException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |