Top Description Fields Constructors Methods
org.springframework.beans

public Class MutablePropertyValues

extends Object
implements PropertyValues, Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable, org.springframework.beans.PropertyValues, java.lang.Iterable
Annotations
@SuppressWarnings:serial
Imports
java.io.Serializable, java.util.ArrayList, .Collections, .HashSet, .Iterator, .List, .Map, .Set, .Spliterator, .Spliterators, java.util.stream.Stream, org.springframework.lang.Nullable, org.springframework.util.StringUtils

The default implementation of the PropertyValues interface. Allows simple manipulation of properties, and provides constructors to support deep copy and construction from a Map.
Authors
Rod Johnson, Juergen Hoeller, Rob Harrop
Since
13 May 2001

Field Summary

Modifier and TypeField and Description
private volatile boolean
private Set<String>
private final List<PropertyValue>

Constructor Summary

AccessConstructor and Description
public
MutablePropertyValues()

Creates a new empty MutablePropertyValues object.

public
MutablePropertyValues(PropertyValues
the PropertyValues to copy
original
)

Deep copy constructor.

public
MutablePropertyValues(Map<?, ?>
a Map with property values keyed by property name Strings
original
)

Construct a new MutablePropertyValues object from a Map.

public
MutablePropertyValues(List<PropertyValue>
a List of PropertyValue objects
propertyValueList
)

Construct a new MutablePropertyValues object using the given List of PropertyValue objects as-is.

Method Summary

Modifier and TypeMethod and Description
public MutablePropertyValues

Returns:

this in order to allow for adding multiple property values in a chain
add
(String
name of the property
propertyName
,
Object
value of the property
propertyValue
)

Add a PropertyValue object, replacing any existing one for the corresponding property or getting merged with it (if applicable).

public MutablePropertyValues

Returns:

this in order to allow for adding multiple property values in a chain
addPropertyValue
(PropertyValue
the PropertyValue object to add
pv
)

Add a PropertyValue object, replacing any existing one for the corresponding property or getting merged with it (if applicable).

public void
addPropertyValue(String
name of the property
propertyName
,
Object
value of the property
propertyValue
)

Overloaded version of addPropertyValue that takes a property name and a property value.

public MutablePropertyValues

Returns:

this in order to allow for adding multiple property values in a chain
addPropertyValues
(PropertyValues
the PropertyValues to copy
other
)

Copy all given PropertyValues into this object.

public MutablePropertyValues

Returns:

this in order to allow for adding multiple property values in a chain
addPropertyValues
(Map<?, ?>
a Map with property values keyed by property name, which must be a String
other
)

Add all property values from the given Map.

public PropertyValues
changesSince(PropertyValues
the old property values
old
)

Implements org.springframework.beans.PropertyValues.changesSince.

Return the changes since the previous PropertyValues.

public void
clearProcessedProperty(String propertyName)

Clear the "processed" registration of the given property, if any.

public boolean
contains(String
the name of the property we're interested in
propertyName
)

Implements org.springframework.beans.PropertyValues.contains.

Is there a property value (or other processing entry) for this property?

public boolean
equals(Object
the reference object with which to compare.
other
)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

public Object

Returns:

the raw property value, or null if none found
get
(String
the name to search for
propertyName
)

Get the raw property value, if any.

public PropertyValue
getPropertyValue(String
the name to search for
propertyName
)

Implements org.springframework.beans.PropertyValues.getPropertyValue.

Return the property value with the given name, if any.

public List<PropertyValue>
getPropertyValueList()

Return the underlying List of PropertyValue objects in its raw form.

public PropertyValue[]
getPropertyValues()

Implements org.springframework.beans.PropertyValues.getPropertyValues.

Return an array of the PropertyValue objects held in this object.

public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for this object.

public boolean
isConverted()

Return whether this holder contains converted values only (true), or whether the values still need to be converted (false).

public boolean
isEmpty()

Implements org.springframework.beans.PropertyValues.isEmpty.

Does this holder not contain any PropertyValue objects at all?

public Iterator<PropertyValue>
iterator()

Overrides default org.springframework.beans.PropertyValues.iterator.

Return an Iterator over the property values.

private PropertyValue
mergeIfRequired(PropertyValue newPv, PropertyValue currentPv)

Merges the value of the supplied 'new' PropertyValue with that of the current PropertyValue if merging is supported and enabled.

public void
registerProcessedProperty(String
the name of the property.
propertyName
)

Register the specified property as "processed" in the sense of some processor calling the corresponding setter method outside the PropertyValue(s) mechanism.

public void
removePropertyValue(PropertyValue
the PropertyValue to remove
pv
)

Remove the given PropertyValue, if contained.

public void
removePropertyValue(String
name of the property
propertyName
)

Overloaded version of removePropertyValue that takes a property name.

public void
setConverted()

Mark this holder as containing converted values only (i.e. no runtime resolution needed anymore).

public void
setPropertyValueAt(PropertyValue pv, int i)

Modify a PropertyValue object held in this object.

public int
size()

Return the number of PropertyValue entries in the list.

public Spliterator<PropertyValue>
spliterator()

Overrides default org.springframework.beans.PropertyValues.spliterator.

Return a Spliterator over the property values.

public Stream<PropertyValue>
stream()

Overrides default org.springframework.beans.PropertyValues.stream.

Return a sequential Stream containing the property values.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAllwaitwaitwait

Field Detail

convertedback to summary
private volatile boolean converted
processedPropertiesback to summary
private Set<String> processedProperties
Annotations
@Nullable
propertyValueListback to summary
private final List<PropertyValue> propertyValueList

Constructor Detail

MutablePropertyValuesback to summary
public MutablePropertyValues()

Creates a new empty MutablePropertyValues object.

Property values can be added with the add method.

See Also
add(String, Object)
MutablePropertyValuesback to summary
public MutablePropertyValues(PropertyValues original)

Deep copy constructor. Guarantees PropertyValue references are independent, although it can't deep copy objects currently referenced by individual PropertyValue objects.

Parameters
original:PropertyValues

the PropertyValues to copy

See Also
addPropertyValues(PropertyValues)
MutablePropertyValuesback to summary
public MutablePropertyValues(Map<?, ?> original)

Construct a new MutablePropertyValues object from a Map.

Parameters
original:Map<?, ?>

a Map with property values keyed by property name Strings

See Also
addPropertyValues(Map)
MutablePropertyValuesback to summary
public MutablePropertyValues(List<PropertyValue> propertyValueList)

Construct a new MutablePropertyValues object using the given List of PropertyValue objects as-is.

This is a constructor for advanced usage scenarios. It is not intended for typical programmatic use.

Parameters
propertyValueList:List<PropertyValue>

a List of PropertyValue objects

Method Detail

addback to summary
public 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).

Parameters
propertyName:String

name of the property

propertyValue:Object

value of the property

Returns:MutablePropertyValues

this in order to allow for adding multiple property values in a chain

addPropertyValueback to summary
public MutablePropertyValues addPropertyValue(PropertyValue pv)

Add a PropertyValue object, replacing any existing one for the corresponding property or getting merged with it (if applicable).

Parameters
pv:PropertyValue

the PropertyValue object to add

Returns:MutablePropertyValues

this in order to allow for adding multiple property values in a chain

addPropertyValueback to summary
public void addPropertyValue(String propertyName, Object propertyValue)

Overloaded version of addPropertyValue that takes a property name and a property value.

Note

we recommend using the more concise and chaining-capable variant add(String, Object).

Parameters
propertyName:String

name of the property

propertyValue:Object

value of the property

See Also
addPropertyValue(PropertyValue)
addPropertyValuesback to summary
public MutablePropertyValues addPropertyValues(PropertyValues other)

Copy all given PropertyValues into this object. Guarantees PropertyValue references are independent, although it can't deep copy objects currently referenced by individual PropertyValue objects.

Parameters
other:PropertyValues

the PropertyValues to copy

Returns:MutablePropertyValues

this in order to allow for adding multiple property values in a chain

addPropertyValuesback to summary
public MutablePropertyValues addPropertyValues(Map<?, ?> other)

Add all property values from the given Map.

Parameters
other:Map<?, ?>

a Map with property values keyed by property name, which must be a String

Returns:MutablePropertyValues

this in order to allow for adding multiple property values in a chain

changesSinceback to summary
public PropertyValues changesSince(PropertyValues old)

Implements org.springframework.beans.PropertyValues.changesSince.

Doc from org.springframework.beans.PropertyValues.changesSince.

Return the changes since the previous PropertyValues. Subclasses should also override equals.

Parameters
old:PropertyValues

the old property values

Returns:PropertyValues

the updated or new properties. Return empty PropertyValues if there are no changes.

Annotations
@Override
clearProcessedPropertyback to summary
public void clearProcessedProperty(String propertyName)

Clear the "processed" registration of the given property, if any.

Since
3.2.13
containsback to summary
public boolean contains(String propertyName)

Implements org.springframework.beans.PropertyValues.contains.

Doc from org.springframework.beans.PropertyValues.contains.

Is there a property value (or other processing entry) for this property?

Parameters
propertyName:String

the name of the property we're interested in

Returns:boolean

whether there is a property value for this property

Annotations
@Override
equalsback to summary
public boolean equals(Object other)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Parameters
other:Object

the reference object with which to compare.

Returns:boolean

true if this object is the same as the obj argument; false otherwise.

Annotations
@Override
getback to summary
public Object get(String propertyName)

Get the raw property value, if any.

Parameters
propertyName:String

the name to search for

Returns:Object

the raw property value, or null if none found

Annotations
@Nullable
Since
4.0
See Also
getPropertyValue(String), PropertyValue#getValue()
getPropertyValueback to summary
public PropertyValue getPropertyValue(String propertyName)

Implements org.springframework.beans.PropertyValues.getPropertyValue.

Doc from org.springframework.beans.PropertyValues.getPropertyValue.

Return the property value with the given name, if any.

Parameters
propertyName:String

the name to search for

Returns:PropertyValue

the property value, or null if none

Annotations
@Override
@Nullable
getPropertyValueListback to summary
public List<PropertyValue> getPropertyValueList()

Return the underlying List of PropertyValue objects in its raw form. The returned List can be modified directly, although this is not recommended.

This is an accessor for optimized access to all PropertyValue objects. It is not intended for typical programmatic use.

getPropertyValuesback to summary
public PropertyValue[] getPropertyValues()

Implements org.springframework.beans.PropertyValues.getPropertyValues.

Doc from org.springframework.beans.PropertyValues.getPropertyValues.

Return an array of the PropertyValue objects held in this object.

Annotations
@Override
hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for this object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Returns:int

a hash code value for this object

Annotations
@Override
isConvertedback to summary
public boolean isConverted()

Return whether this holder contains converted values only (true), or whether the values still need to be converted (false).

isEmptyback to summary
public boolean isEmpty()

Implements org.springframework.beans.PropertyValues.isEmpty.

Doc from org.springframework.beans.PropertyValues.isEmpty.

Does this holder not contain any PropertyValue objects at all?

Annotations
@Override
iteratorback to summary
public Iterator<PropertyValue> iterator()

Overrides default org.springframework.beans.PropertyValues.iterator.

Doc from org.springframework.beans.PropertyValues.iterator.

Return an Iterator over the property values.

Returns:Iterator<PropertyValue>

Doc from java.lang.Iterable.iterator.

an Iterator.

Annotations
@Override
mergeIfRequiredback to summary
private PropertyValue mergeIfRequired(PropertyValue newPv, PropertyValue currentPv)

Merges the value of the supplied 'new' PropertyValue with that of the current PropertyValue if merging is supported and enabled.

See Also
Mergeable
registerProcessedPropertyback to summary
public void registerProcessedProperty(String propertyName)

Register the specified property as "processed" in the sense of some processor calling the corresponding setter method outside the PropertyValue(s) mechanism.

This will lead to true being returned from a contains call for the specified property.

Parameters
propertyName:String

the name of the property.

removePropertyValueback to summary
public void removePropertyValue(PropertyValue pv)

Remove the given PropertyValue, if contained.

Parameters
pv:PropertyValue

the PropertyValue to remove

removePropertyValueback to summary
public void removePropertyValue(String propertyName)

Overloaded version of removePropertyValue that takes a property name.

Parameters
propertyName:String

name of the property

See Also
removePropertyValue(PropertyValue)
setConvertedback to summary
public void setConverted()

Mark this holder as containing converted values only (i.e. no runtime resolution needed anymore).

setPropertyValueAtback to summary
public void setPropertyValueAt(PropertyValue pv, int i)

Modify a PropertyValue object held in this object. Indexed from 0.

sizeback to summary
public int size()

Return the number of PropertyValue entries in the list.

spliteratorback to summary
public Spliterator<PropertyValue> spliterator()

Overrides default org.springframework.beans.PropertyValues.spliterator.

Doc from org.springframework.beans.PropertyValues.spliterator.

Return a Spliterator over the property values.

Returns:Spliterator<PropertyValue>

Doc from java.lang.Iterable.spliterator.

a Spliterator over the elements described by this Iterable.

Annotations
@Override
streamback to summary
public Stream<PropertyValue> stream()

Overrides default org.springframework.beans.PropertyValues.stream.

Doc from org.springframework.beans.PropertyValues.stream.

Return a sequential Stream containing the property values.

Annotations
@Override
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

Annotations
@Override