类 MutablePropertyValues
- java.lang.Object
- org.springframework.beans.MutablePropertyValues
- 所有已实现的接口:
Serializable
,Iterable<PropertyValue>
,PropertyValues
public class MutablePropertyValues extends Object implements PropertyValues, Serializable
The default implementation of thePropertyValues
interface. Allows simple manipulation of properties, and provides constructors to support deep copy and construction from a Map.- 从以下版本开始:
- 13 May 2001
- 作者:
- Rod Johnson, Juergen Hoeller, Rob Harrop
- 另请参阅:
- 序列化表格
构造器概要
构造器 构造器 说明 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.
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 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).void
addPropertyValue(String propertyName, Object propertyValue)
Overloaded version ofaddPropertyValue
that takes a property name and a property value.MutablePropertyValues
addPropertyValue(PropertyValue pv)
Add a PropertyValue object, replacing any existing one for the corresponding property or getting merged with it (if applicable).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 anIterator
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(String propertyName)
Overloaded version ofremovePropertyValue
that takes a property name.void
removePropertyValue(PropertyValue pv)
Remove the given PropertyValue, if contained.void
setConverted()
Mark this holder as containing converted values only (i.e. no runtime resolution needed anymore).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 aSpliterator
over the property values.Stream<PropertyValue>
stream()
Return a sequentialStream
containing the property values.String
toString()
构造器详细资料
MutablePropertyValues
public MutablePropertyValues()
Creates a new empty MutablePropertyValues object.Property values can be added with the
add
method.- 另请参阅:
add(String, Object)
MutablePropertyValues
public MutablePropertyValues(@Nullable PropertyValues original)
Deep copy constructor. Guarantees PropertyValue references are independent, although it can't deep copy objects currently referenced by individual PropertyValue objects.- 参数:
original
- the PropertyValues to copy- 另请参阅:
addPropertyValues(PropertyValues)
MutablePropertyValues
public MutablePropertyValues(@Nullable Map<?,?> original)
Construct a new MutablePropertyValues object from a Map.- 参数:
original
- a Map with property values keyed by property name Strings- 另请参阅:
addPropertyValues(Map)
MutablePropertyValues
public MutablePropertyValues(@Nullable 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.
- 参数:
propertyValueList
- a List of PropertyValue objects
方法详细资料
getPropertyValueList
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.
size
public int size()
Return the number of PropertyValue entries in the list.
addPropertyValues
public MutablePropertyValues addPropertyValues(@Nullable 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.- 参数:
other
- the PropertyValues to copy- 返回:
- this in order to allow for adding multiple property values in a chain
addPropertyValues
public MutablePropertyValues addPropertyValues(@Nullable Map<?,?> other)
Add all property values from the given Map.- 参数:
other
- a Map with property values keyed by property name, which must be a String- 返回:
- this in order to allow for adding multiple property values in a chain
addPropertyValue
public MutablePropertyValues addPropertyValue(PropertyValue pv)
Add a PropertyValue object, replacing any existing one for the corresponding property or getting merged with it (if applicable).- 参数:
pv
- the PropertyValue object to add- 返回:
- this in order to allow for adding multiple property values in a chain
addPropertyValue
public void addPropertyValue(String propertyName, Object propertyValue)
Overloaded version ofaddPropertyValue
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 property- 另请参阅:
addPropertyValue(PropertyValue)
add
public MutablePropertyValues add(String propertyName, @Nullable Object propertyValue)
Add a PropertyValue object, replacing any existing one for the corresponding property or getting merged with it (if applicable).- 参数:
propertyName
- name of the propertypropertyValue
- value of the property- 返回:
- this in order to allow for adding multiple property values in a chain
setPropertyValueAt
public void setPropertyValueAt(PropertyValue pv, int i)
Modify a PropertyValue object held in this object. Indexed from 0.
removePropertyValue
public void removePropertyValue(PropertyValue pv)
Remove the given PropertyValue, if contained.- 参数:
pv
- the PropertyValue to remove
removePropertyValue
public void removePropertyValue(String propertyName)
Overloaded version ofremovePropertyValue
that takes a property name.- 参数:
propertyName
- name of the property- 另请参阅:
removePropertyValue(PropertyValue)
iterator
public Iterator<PropertyValue> iterator()
从接口复制的说明:PropertyValues
Return anIterator
over the property values.- 指定者:
iterator
在接口中Iterable<PropertyValue>
- 指定者:
iterator
在接口中PropertyValues
spliterator
public Spliterator<PropertyValue> spliterator()
从接口复制的说明:PropertyValues
Return aSpliterator
over the property values.- 指定者:
spliterator
在接口中Iterable<PropertyValue>
- 指定者:
spliterator
在接口中PropertyValues
stream
public Stream<PropertyValue> stream()
从接口复制的说明:PropertyValues
Return a sequentialStream
containing the property values.- 指定者:
stream
在接口中PropertyValues
getPropertyValues
public PropertyValue[] getPropertyValues()
从接口复制的说明:PropertyValues
Return an array of the PropertyValue objects held in this object.- 指定者:
getPropertyValues
在接口中PropertyValues
getPropertyValue
@Nullable public PropertyValue getPropertyValue(String propertyName)
从接口复制的说明:PropertyValues
Return the property value with the given name, if any.- 指定者:
getPropertyValue
在接口中PropertyValues
- 参数:
propertyName
- the name to search for- 返回:
- the property value, or
null
if none
get
@Nullable public Object get(String propertyName)
Get the raw property value, if any.- 参数:
propertyName
- the name to search for- 返回:
- the raw property value, or
null
if none found - 从以下版本开始:
- 4.0
- 另请参阅:
getPropertyValue(String)
,PropertyValue.getValue()
changesSince
public PropertyValues changesSince(PropertyValues old)
从接口复制的说明:PropertyValues
Return the changes since the previous PropertyValues. Subclasses should also overrideequals
.- 指定者:
changesSince
在接口中PropertyValues
- 参数:
old
- the old property values- 返回:
- the updated or new properties. Return empty PropertyValues if there are no changes.
- 另请参阅:
Object.equals(java.lang.Object)
contains
public boolean contains(String propertyName)
从接口复制的说明:PropertyValues
Is there a property value (or other processing entry) for this property?- 指定者:
contains
在接口中PropertyValues
- 参数:
propertyName
- the name of the property we're interested in- 返回:
- whether there is a property value for this property
isEmpty
public boolean isEmpty()
从接口复制的说明:PropertyValues
Does this holder not contain any PropertyValue objects at all?- 指定者:
isEmpty
在接口中PropertyValues
registerProcessedProperty
public 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.This will lead to
true
being returned from acontains(java.lang.String)
call for the specified property.- 参数:
propertyName
- the name of the property.
clearProcessedProperty
public void clearProcessedProperty(String propertyName)
Clear the "processed" registration of the given property, if any.- 从以下版本开始:
- 3.2.13
setConverted
public void setConverted()
Mark this holder as containing converted values only (i.e. no runtime resolution needed anymore).
isConverted
public boolean isConverted()
Return whether this holder contains converted values only (true
), or whether the values still need to be converted (false
).