public class MutablePropertyValues extends Object implements PropertyValues, Serializable
PropertyValues
interface.
Allows simple manipulation of properties, and provides constructors
to support deep copy and construction from a Map.Constructor and Description |
---|
MutablePropertyValues()
Creates a new empty MutablePropertyValues object.
|
MutablePropertyValues(List<PropertyValue> propertyValueList)
Construct a new MutablePropertyValues object using the given List of
PropertyValue objects as-is.
|
MutablePropertyValues(Map<?,?> original)
Construct a new MutablePropertyValues object from a Map.
|
MutablePropertyValues(PropertyValues original)
Deep copy constructor.
|
Modifier and Type | Method and Description |
---|---|
MutablePropertyValues |
add(String propertyName,
Object propertyValue)
Add a PropertyValue object, replacing any existing one for the
corresponding property or getting merged with it (if applicable).
|
MutablePropertyValues |
addPropertyValue(PropertyValue pv)
Add a PropertyValue object, replacing any existing one for the
corresponding property or getting merged with it (if applicable).
|
void |
addPropertyValue(String propertyName,
Object propertyValue)
Overloaded version of
addPropertyValue that takes
a property name and a property value. |
MutablePropertyValues |
addPropertyValues(Map<?,?> other)
Add all property values from the given Map.
|
MutablePropertyValues |
addPropertyValues(PropertyValues other)
Copy all given PropertyValues into this object.
|
PropertyValues |
changesSince(PropertyValues old)
Return the changes since the previous PropertyValues.
|
void |
clearProcessedProperty(String propertyName)
Clear the "processed" registration of the given property, if any.
|
boolean |
contains(String propertyName)
Is there a property value (or other processing entry) for this property?
|
boolean |
equals(Object other) |
Object |
get(String propertyName)
Get the raw property value, if any.
|
PropertyValue |
getPropertyValue(String propertyName)
Return the property value with the given name, if any.
|
List<PropertyValue> |
getPropertyValueList()
Return the underlying List of PropertyValue objects in its raw form.
|
PropertyValue[] |
getPropertyValues()
Return an array of the PropertyValue objects held in this object.
|
int |
hashCode() |
boolean |
isConverted()
Return whether this holder contains converted values only (
true ),
or whether the values still need to be converted (false ). |
boolean |
isEmpty()
Does this holder not contain any PropertyValue objects at all?
|
Iterator<PropertyValue> |
iterator()
Return an
Iterator over the property values. |
void |
registerProcessedProperty(String propertyName)
Register the specified property as "processed" in the sense
of some processor calling the corresponding setter method
outside of the PropertyValue(s) mechanism.
|
void |
removePropertyValue(PropertyValue pv)
Remove the given PropertyValue, if contained.
|
void |
removePropertyValue(String propertyName)
Overloaded version of
removePropertyValue that takes a property name. |
void |
setConverted()
Mark this holder as containing converted values only
(i.e.
|
void |
setPropertyValueAt(PropertyValue pv,
int i)
Modify a PropertyValue object held in this object.
|
int |
size()
Return the number of PropertyValue entries in the list.
|
Spliterator<PropertyValue> |
spliterator()
Return a
Spliterator over the property values. |
Stream<PropertyValue> |
stream()
Return a sequential
Stream containing the property values. |
String |
toString() |
public MutablePropertyValues()
Property values can be added with the add
method.
add(String, Object)
public MutablePropertyValues(@Nullable PropertyValues original)
original
- the PropertyValues to copyaddPropertyValues(PropertyValues)
public MutablePropertyValues(@Nullable Map<?,?> original)
original
- a Map with property values keyed by property name StringsaddPropertyValues(Map)
public MutablePropertyValues(@Nullable List<PropertyValue> propertyValueList)
This is a constructor for advanced usage scenarios. It is not intended for typical programmatic use.
propertyValueList
- a List of PropertyValue objectspublic List<PropertyValue> getPropertyValueList()
This is an accessor for optimized access to all PropertyValue objects. It is not intended for typical programmatic use.
public int size()
public MutablePropertyValues addPropertyValues(@Nullable PropertyValues other)
other
- the PropertyValues to copypublic MutablePropertyValues addPropertyValues(@Nullable Map<?,?> other)
other
- a Map with property values keyed by property name,
which must be a Stringpublic MutablePropertyValues addPropertyValue(PropertyValue pv)
pv
- the PropertyValue object to addpublic void addPropertyValue(String propertyName, Object propertyValue)
addPropertyValue
that takes
a property name and a property value.
Note: As of Spring 3.0, we recommend using the more concise
and chaining-capable variant add(java.lang.String, java.lang.Object)
.
propertyName
- name of the propertypropertyValue
- value of the propertyaddPropertyValue(PropertyValue)
public MutablePropertyValues add(String propertyName, @Nullable Object propertyValue)
propertyName
- name of the propertypropertyValue
- value of the propertypublic void setPropertyValueAt(PropertyValue pv, int i)
public void removePropertyValue(PropertyValue pv)
pv
- the PropertyValue to removepublic void removePropertyValue(String propertyName)
removePropertyValue
that takes a property name.propertyName
- name of the propertyremovePropertyValue(PropertyValue)
public Iterator<PropertyValue> iterator()
PropertyValues
Iterator
over the property values.iterator
in interface Iterable<PropertyValue>
iterator
in interface PropertyValues
public Spliterator<PropertyValue> spliterator()
PropertyValues
Spliterator
over the property values.spliterator
in interface Iterable<PropertyValue>
spliterator
in interface PropertyValues
public Stream<PropertyValue> stream()
PropertyValues
Stream
containing the property values.stream
in interface PropertyValues
public PropertyValue[] getPropertyValues()
PropertyValues
getPropertyValues
in interface PropertyValues
@Nullable public PropertyValue getPropertyValue(String propertyName)
PropertyValues
getPropertyValue
in interface PropertyValues
propertyName
- the name to search fornull
if none@Nullable public Object get(String propertyName)
propertyName
- the name to search fornull
if none foundgetPropertyValue(String)
,
PropertyValue.getValue()
public PropertyValues changesSince(PropertyValues old)
PropertyValues
equals
.changesSince
in interface PropertyValues
old
- old property valuesObject.equals(java.lang.Object)
public boolean contains(String propertyName)
PropertyValues
contains
in interface PropertyValues
propertyName
- the name of the property we're interested inpublic boolean isEmpty()
PropertyValues
isEmpty
in interface PropertyValues
public void registerProcessedProperty(String propertyName)
This will lead to true
being returned from
a contains(java.lang.String)
call for the specified property.
propertyName
- the name of the property.public void clearProcessedProperty(String propertyName)
public void setConverted()
public boolean isConverted()
true
),
or whether the values still need to be converted (false
).