Package org.springframework.beans
Class MutablePropertyValues
java.lang.Object
org.springframework.beans.MutablePropertyValues
- All Implemented Interfaces:
- Serializable,- Iterable<PropertyValue>,- PropertyValues
- Direct Known Subclasses:
- ServletRequestParameterPropertyValues
The default implementation of the 
PropertyValues interface.
 Allows simple manipulation of properties, and provides constructors
 to support deep copy and construction from a Map.- Since:
- 13 May 2001
- Author:
- Rod Johnson, Juergen Hoeller, Rob Harrop
- See Also:
- 
Constructor SummaryConstructorsConstructorDescriptionCreates a new empty MutablePropertyValues object.MutablePropertyValues(@Nullable List<PropertyValue> propertyValueList) Construct a new MutablePropertyValues object using the given List of PropertyValue objects as-is.MutablePropertyValues(@Nullable Map<?, ?> original) Construct a new MutablePropertyValues object from a Map.MutablePropertyValues(@Nullable PropertyValues original) Deep copy constructor.
- 
Method SummaryModifier and TypeMethodDescriptionAdd a PropertyValue object, replacing any existing one for the corresponding property or getting merged with it (if applicable).voidaddPropertyValue(String propertyName, Object propertyValue) Overloaded version ofaddPropertyValuethat takes a property name and a property value.Add a PropertyValue object, replacing any existing one for the corresponding property or getting merged with it (if applicable).addPropertyValues(@Nullable Map<?, ?> other) Add all property values from the given Map.Copy all given PropertyValues into this object.Return the changes since the previous PropertyValues.voidclearProcessedProperty(String propertyName) Clear the "processed" registration of the given property, if any.booleanIs there a property value (or other processing entry) for this property?booleanGet the raw property value, if any.getPropertyValue(String propertyName) Return the property value with the given name, if any.Return the underlying List of PropertyValue objects in its raw form.Return an array of the PropertyValue objects held in this object.inthashCode()booleanReturn whether this holder contains converted values only (true), or whether the values still need to be converted (false).booleanisEmpty()Does this holder not contain any PropertyValue objects at all?iterator()Return anIteratorover the property values.voidregisterProcessedProperty(String propertyName) Register the specified property as "processed" in the sense of some processor calling the corresponding setter method outside the PropertyValue(s) mechanism.voidremovePropertyValue(String propertyName) Overloaded version ofremovePropertyValuethat takes a property name.voidRemove the given PropertyValue, if contained.voidMark this holder as containing converted values only (i.e.voidsetPropertyValueAt(PropertyValue pv, int i) Modify a PropertyValue object held in this object.intsize()Return the number of PropertyValue entries in the list.Return aSpliteratorover the property values.stream()Return a sequentialStreamcontaining the property values.toString()
- 
Constructor Details- 
MutablePropertyValuespublic MutablePropertyValues()Creates a new empty MutablePropertyValues object.Property values can be added with the addmethod.- See Also:
 
- 
MutablePropertyValuesDeep copy constructor. Guarantees PropertyValue references are independent, although it can't deep copy objects currently referenced by individual PropertyValue objects.- Parameters:
- original- the PropertyValues to copy
- See Also:
 
- 
MutablePropertyValuesConstruct a new MutablePropertyValues object from a Map.- Parameters:
- original- a Map with property values keyed by property name Strings
- See Also:
 
- 
MutablePropertyValuesConstruct 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- a List of PropertyValue objects
 
 
- 
- 
Method Details- 
getPropertyValueListReturn 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. 
- 
sizepublic int size()Return the number of PropertyValue entries in the list.
- 
addPropertyValuesCopy 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- the PropertyValues to copy
- Returns:
- this in order to allow for adding multiple property values in a chain
 
- 
addPropertyValuesAdd all property values from the given Map.- Parameters:
- other- a Map with property values keyed by property name, which must be a String
- Returns:
- this in order to allow for adding multiple property values in a chain
 
- 
addPropertyValueAdd a PropertyValue object, replacing any existing one for the corresponding property or getting merged with it (if applicable).- Parameters:
- pv- the PropertyValue object to add
- Returns:
- this in order to allow for adding multiple property values in a chain
 
- 
addPropertyValueOverloaded version ofaddPropertyValuethat takes a property name and a property value.Note: we recommend using the more concise and chaining-capable variant add(String, Object).- Parameters:
- propertyName- name of the property
- propertyValue- value of the property
- See Also:
 
- 
addAdd a PropertyValue object, replacing any existing one for the corresponding property or getting merged with it (if applicable).- Parameters:
- propertyName- name of the property
- propertyValue- value of the property
- Returns:
- this in order to allow for adding multiple property values in a chain
 
- 
setPropertyValueAtModify a PropertyValue object held in this object. Indexed from 0.
- 
removePropertyValueRemove the given PropertyValue, if contained.- Parameters:
- pv- the PropertyValue to remove
 
- 
removePropertyValueOverloaded version ofremovePropertyValuethat takes a property name.- Parameters:
- propertyName- name of the property
- See Also:
 
- 
iteratorDescription copied from interface:PropertyValuesReturn anIteratorover the property values.- Specified by:
- iteratorin interface- Iterable<PropertyValue>
- Specified by:
- iteratorin interface- PropertyValues
 
- 
spliteratorDescription copied from interface:PropertyValuesReturn aSpliteratorover the property values.- Specified by:
- spliteratorin interface- Iterable<PropertyValue>
- Specified by:
- spliteratorin interface- PropertyValues
 
- 
streamDescription copied from interface:PropertyValuesReturn a sequentialStreamcontaining the property values.- Specified by:
- streamin interface- PropertyValues
 
- 
getPropertyValuesDescription copied from interface:PropertyValuesReturn an array of the PropertyValue objects held in this object.- Specified by:
- getPropertyValuesin interface- PropertyValues
 
- 
getPropertyValueDescription copied from interface:PropertyValuesReturn the property value with the given name, if any.- Specified by:
- getPropertyValuein interface- PropertyValues
- Parameters:
- propertyName- the name to search for
- Returns:
- the property value, or nullif none
 
- 
getGet the raw property value, if any.- Parameters:
- propertyName- the name to search for
- Returns:
- the raw property value, or nullif none found
- Since:
- 4.0
- See Also:
 
- 
changesSinceDescription copied from interface:PropertyValuesReturn the changes since the previous PropertyValues. Subclasses should also overrideequals.- Specified by:
- changesSincein interface- PropertyValues
- Parameters:
- old- the old property values
- Returns:
- the updated or new properties. Return empty PropertyValues if there are no changes.
- See Also:
 
- 
containsDescription copied from interface:PropertyValuesIs there a property value (or other processing entry) for this property?- Specified by:
- containsin interface- PropertyValues
- Parameters:
- propertyName- the name of the property we're interested in
- Returns:
- whether there is a property value for this property
 
- 
isEmptypublic boolean isEmpty()Description copied from interface:PropertyValuesDoes this holder not contain any PropertyValue objects at all?- Specified by:
- isEmptyin interface- PropertyValues
 
- 
registerProcessedPropertyRegister 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 truebeing returned from acontains(java.lang.String)call for the specified property.- Parameters:
- propertyName- the name of the property.
 
- 
clearProcessedPropertyClear the "processed" registration of the given property, if any.- Since:
- 3.2.13
 
- 
setConvertedpublic void setConverted()Mark this holder as containing converted values only (i.e. no runtime resolution needed anymore).
- 
isConvertedpublic boolean isConverted()Return whether this holder contains converted values only (true), or whether the values still need to be converted (false).
- 
equals
- 
hashCodepublic int hashCode()
- 
toString
 
-