类 AbstractPropertyAccessor
- java.lang.Object
- org.springframework.beans.PropertyEditorRegistrySupport
- org.springframework.beans.TypeConverterSupport
- org.springframework.beans.AbstractPropertyAccessor
public abstract class AbstractPropertyAccessor extends TypeConverterSupport implements ConfigurablePropertyAccessor
Abstract implementation of thePropertyAccessorinterface. Provides base implementations of all convenience methods, with the implementation of actual property access left to subclasses.- 从以下版本开始:
- 2.0
- 作者:
- Juergen Hoeller, Stephane Nicoll
- 另请参阅:
getPropertyValue(java.lang.String),setPropertyValue(org.springframework.beans.PropertyValue)
字段概要
从接口继承的字段 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
构造器概要
构造器 构造器 说明 AbstractPropertyAccessor()
方法概要
所有方法 实例方法 抽象方法 具体方法 修饰符和类型 方法 说明 Class<?>getPropertyType(String propertyPath)Determine the property type for the given property path.abstract ObjectgetPropertyValue(String propertyName)Actually get the value of a property.booleanisAutoGrowNestedPaths()Return whether "auto-growing" of nested paths has been activated.booleanisExtractOldValueForEditor()Return 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, Object value)Actually set a property value.voidsetPropertyValue(PropertyValue pv)Set the specified value as current property value.voidsetPropertyValues(Map<?,?> map)Perform a batch update from a Map.voidsetPropertyValues(PropertyValues pvs)The 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.从类继承的方法 org.springframework.beans.TypeConverterSupport
convertIfNecessary, convertIfNecessary, convertIfNecessary
从类继承的方法 org.springframework.beans.PropertyEditorRegistrySupport
copyCustomEditorsTo, copyDefaultEditorsTo, findCustomEditor, getConversionService, getDefaultEditor, guessPropertyTypeFromEditors, hasCustomEditorForElement, overrideDefaultEditor, registerCustomEditor, registerCustomEditor, registerDefaultEditors, setConversionService, useConfigValueEditors
从类继承的方法 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
从接口继承的方法 org.springframework.beans.ConfigurablePropertyAccessor
getConversionService, setConversionService
从接口继承的方法 org.springframework.beans.PropertyAccessor
getPropertyTypeDescriptor, isReadableProperty, isWritableProperty
从接口继承的方法 org.springframework.beans.PropertyEditorRegistry
findCustomEditor, registerCustomEditor, registerCustomEditor
从接口继承的方法 org.springframework.beans.TypeConverter
convertIfNecessary, convertIfNecessary, convertIfNecessary
构造器详细资料
AbstractPropertyAccessor
public AbstractPropertyAccessor()
方法详细资料
setExtractOldValueForEditor
public void setExtractOldValueForEditor(boolean extractOldValueForEditor)
从接口复制的说明:ConfigurablePropertyAccessorSet whether to extract the old property value when applying a property editor to a new value for a property.
isExtractOldValueForEditor
public boolean isExtractOldValueForEditor()
从接口复制的说明:ConfigurablePropertyAccessorReturn whether to extract the old property value when applying a property editor to a new value for a property.
setAutoGrowNestedPaths
public void setAutoGrowNestedPaths(boolean autoGrowNestedPaths)
从接口复制的说明: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.
isAutoGrowNestedPaths
public boolean isAutoGrowNestedPaths()
从接口复制的说明:ConfigurablePropertyAccessorReturn whether "auto-growing" of nested paths has been activated.
setPropertyValue
public void setPropertyValue(PropertyValue pv) throws BeansException
从接口复制的说明:PropertyAccessorSet the specified value as current property value.- 指定者:
setPropertyValue在接口中PropertyAccessor- 参数:
pv- an object containing the new property value- 抛出:
InvalidPropertyException- if there is no such property or if the property isn't writablePropertyAccessException- if the property was valid but the accessor method failed or a type mismatch occurredBeansException
setPropertyValues
public void setPropertyValues(Map<?,?> map) throws BeansException
从接口复制的说明: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.- 指定者:
setPropertyValues在接口中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 writablePropertyBatchUpdateException- if one or more PropertyAccessExceptions occurred for specific properties during the batch update. This exception bundles all individual PropertyAccessExceptions. All other properties will have been successfully updated.BeansException
setPropertyValues
public void setPropertyValues(PropertyValues pvs) throws BeansException
从接口复制的说明: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.
- 指定者:
setPropertyValues在接口中PropertyAccessor- 参数:
pvs- PropertyValues to set on the target object- 抛出:
InvalidPropertyException- if there is no such property or if the property isn't writablePropertyBatchUpdateException- if one or more PropertyAccessExceptions occurred 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)
setPropertyValues
public void setPropertyValues(PropertyValues pvs, boolean ignoreUnknown) throws BeansException
从接口复制的说明: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.- 指定者:
setPropertyValues在接口中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 writablePropertyBatchUpdateException- if one or more PropertyAccessExceptions occurred 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)
setPropertyValues
public void setPropertyValues(PropertyValues pvs, boolean ignoreUnknown, boolean ignoreInvalid) throws BeansException
从接口复制的说明: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.- 指定者:
setPropertyValues在接口中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 writablePropertyBatchUpdateException- if one or more PropertyAccessExceptions occurred for specific properties during the batch update. This exception bundles all individual PropertyAccessExceptions. All other properties will have been successfully updated.BeansException
getPropertyType
public Class<?> getPropertyType(String propertyPath)
从类复制的说明:PropertyEditorRegistrySupportDetermine the property type for the given property path.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 standardgetPropertyTypemethod as defined by the BeanWrapper interface.- 指定者:
getPropertyType在接口中PropertyAccessor- 覆盖:
getPropertyType在类中PropertyEditorRegistrySupport- 参数:
propertyPath- the property path to determine the type for- 返回:
- the type of the property, or
nullif not determinable - 另请参阅:
PropertyAccessor.getPropertyType(String)
getPropertyValue
public abstract Object getPropertyValue(String propertyName) throws BeansException
Actually get the value of a property.- 指定者:
getPropertyValue在接口中PropertyAccessor- 参数:
propertyName- name of the property to get the value of- 返回:
- the value of the property
- 抛出:
InvalidPropertyException- if there is no such property or if the property isn't readablePropertyAccessException- if the property was valid but the accessor method failedInvalidPropertyException- if there is no such property or if the property isn't readablePropertyAccessException- if the property was valid but the accessor method failedBeansException
setPropertyValue
public abstract void setPropertyValue(String propertyName, Object value) throws BeansException
Actually set a property value.- 指定者:
setPropertyValue在接口中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 writablePropertyAccessException- if the property was valid but the accessor method failed or a type mismatch occurredInvalidPropertyException- if there is no such property or if the property isn't writablePropertyAccessException- if the property was valid but the accessor method failed or a type mismatch occurredBeansException