org.springframework.beans
public class: PropertyValue [javadoc |
source]
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.
| Field Summary |
|---|
| volatile Boolean | conversionNecessary | Package-visible field that indicates whether conversion is necessary |
| volatile Object | resolvedTokens | Package-visible field for caching the resolved property path tokens |
| volatile PropertyDescriptor | resolvedDescriptor | Package-visible field for caching the resolved PropertyDescriptor |
| Constructor: |
public PropertyValue(PropertyValue original) {
Assert.notNull(original, "Original must not be null");
this.name = original.getName();
this.value = original.getValue();
this.source = original.getSource();
this.conversionNecessary = original.conversionNecessary;
this.resolvedTokens = original.resolvedTokens;
this.resolvedDescriptor = original.resolvedDescriptor;
copyAttributesFrom(original);
}
Parameters:
original - the PropertyValue to copy (never null)
|
public PropertyValue(String name,
Object value) {
this.name = name;
this.value = value;
}
Create a new PropertyValue instance. Parameters:
name - the name of the property (never null)
value - the value of the property (possibly before type conversion)
|
public PropertyValue(PropertyValue original,
Object newValue) {
Assert.notNull(original, "Original must not be null");
this.name = original.getName();
this.value = newValue;
this.source = original;
this.conversionNecessary = original.conversionNecessary;
this.resolvedTokens = original.resolvedTokens;
this.resolvedDescriptor = original.resolvedDescriptor;
copyAttributesFrom(original);
}
Constructor 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
|