Class PropertyValue
java.lang.Object
org.springframework.core.AttributeAccessorSupport
org.springframework.beans.BeanMetadataAttributeAccessor
org.springframework.beans.PropertyValue
- All Implemented Interfaces:
- Serializable, BeanMetadataElement, AttributeAccessor
Object to hold information and value for an individual bean property.
Using an object here, rather than just storing all properties in
a map keyed by property name, allows for more flexibility, and the
ability to handle indexed properties etc in an optimized way.
Note that the value doesn't need to be the final required type:
A BeanWrapper implementation should handle any necessary conversion,
as this object doesn't know anything about the objects it will be applied to.
- Since:
- 13 May 2001
- Author:
- Rod Johnson, Rob Harrop, Juergen Hoeller
- See Also:
- 
Constructor SummaryConstructorsConstructorDescriptionPropertyValue(String name, @Nullable Object value) Create a new PropertyValue instance.PropertyValue(PropertyValue original) Copy constructor.PropertyValue(PropertyValue original, @Nullable Object newValue) Constructor that exposes a new value for an original value holder.
- 
Method SummaryModifier and TypeMethodDescriptionbooleanReturn the converted value of this property value, after processed type conversion.getName()Return the name of the property.Return the original PropertyValue instance for this value holder.getValue()Return the value of the property.inthashCode()booleanReturn whether this holder contains a converted value already (true), or whether the value still needs to be converted (false).booleanReturn whether this is an optional value, that is, to be ignored when no corresponding property exists on the target class.voidsetConvertedValue(@Nullable Object value) Set the converted value of this property value, after processed type conversion.voidsetOptional(boolean optional) Set whether this is an optional value, that is, to be ignored when no corresponding property exists on the target class.toString()Methods inherited from class BeanMetadataAttributeAccessoraddMetadataAttribute, getAttribute, getMetadataAttribute, getSource, removeAttribute, setAttribute, setSourceMethods inherited from class AttributeAccessorSupportattributeNames, computeAttribute, copyAttributesFrom, hasAttribute
- 
Constructor Details- 
PropertyValue
- 
PropertyValueCopy constructor.- Parameters:
- original- the PropertyValue to copy (never- null)
 
- 
PropertyValueConstructor that exposes a new value for an original value holder. The original holder will be exposed as source of the new holder.- Parameters:
- original- the PropertyValue to link to (never- null)
- newValue- the new value to apply
 
 
- 
- 
Method Details- 
getNameReturn the name of the property.
- 
getValue
- 
getOriginalPropertyValueReturn the original PropertyValue instance for this value holder.- Returns:
- the original PropertyValue (either a source of this value holder or this value holder itself).
 
- 
setOptionalpublic void setOptional(boolean optional) Set whether this is an optional value, that is, to be ignored when no corresponding property exists on the target class.- Since:
- 3.0
 
- 
isOptionalpublic boolean isOptional()Return whether this is an optional value, that is, to be ignored when no corresponding property exists on the target class.- Since:
- 3.0
 
- 
isConvertedpublic boolean isConverted()Return whether this holder contains a converted value already (true), or whether the value still needs to be converted (false).
- 
setConvertedValue
- 
getConvertedValue
- 
equals- Overrides:
- equalsin class- AttributeAccessorSupport
 
- 
hashCodepublic int hashCode()- Overrides:
- hashCodein class- AttributeAccessorSupport
 
- 
toString
 
-