public class PropertyValue extends BeanMetadataAttributeAccessor implements Serializable
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.
PropertyValues
,
BeanWrapper
,
Serialized FormConstructor and Description |
---|
PropertyValue(PropertyValue original)
Copy constructor.
|
PropertyValue(PropertyValue original,
Object newValue)
Constructor that exposes a new value for an original value holder.
|
PropertyValue(String name,
Object value)
Create a new PropertyValue instance.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object other) |
Object |
getConvertedValue()
Return the converted value of this property value,
after processed type conversion.
|
String |
getName()
Return the name of the property.
|
PropertyValue |
getOriginalPropertyValue()
Return the original PropertyValue instance for this value holder.
|
Object |
getValue()
Return the value of the property.
|
int |
hashCode() |
boolean |
isConverted()
Return whether this holder contains a converted value already (
true ),
or whether the value still needs to be converted (false ). |
boolean |
isOptional()
Return whether this is an optional value, that is, to be ignored
when no corresponding property exists on the target class.
|
void |
setConvertedValue(Object value)
Set the converted value of this property value,
after processed type conversion.
|
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.
|
String |
toString() |
addMetadataAttribute, getAttribute, getMetadataAttribute, getSource, removeAttribute, setAttribute, setSource
public PropertyValue(String name, @Nullable Object value)
name
- the name of the property (never null
)value
- the value of the property (possibly before type conversion)public PropertyValue(PropertyValue original)
original
- the PropertyValue to copy (never null
)public PropertyValue(PropertyValue original, @Nullable Object newValue)
original
- the PropertyValue to link to (never null
)newValue
- the new value to applypublic String getName()
@Nullable public Object getValue()
Note that type conversion will not have occurred here. It is the responsibility of the BeanWrapper implementation to perform type conversion.
public PropertyValue getOriginalPropertyValue()
public void setOptional(boolean optional)
public boolean isOptional()
public boolean isConverted()
true
),
or whether the value still needs to be converted (false
).public void setConvertedValue(@Nullable Object value)
@Nullable public Object getConvertedValue()
public boolean equals(@Nullable Object other)
equals
in class org.springframework.core.AttributeAccessorSupport
public int hashCode()
hashCode
in class org.springframework.core.AttributeAccessorSupport