interface.
Allows simple manipulation of properties, and provides constructors
to support deep copy and construction from a Map.
| Method from org.springframework.beans.MutablePropertyValues Detail: |
public MutablePropertyValues addPropertyValue(PropertyValue pv) {
for (int i = 0; i < this.propertyValueList.size(); i++) {
PropertyValue currentPv = (PropertyValue) this.propertyValueList.get(i);
if (currentPv.getName().equals(pv.getName())) {
pv = mergeIfRequired(pv, currentPv);
setPropertyValueAt(pv, i);
return this;
}
}
this.propertyValueList.add(pv);
return this;
}
Add a PropertyValue object, replacing any existing one
for the corresponding property. |
public void addPropertyValue(String propertyName,
Object propertyValue) {
addPropertyValue(new PropertyValue(propertyName, propertyValue));
}
Overloaded version of addPropertyValue that takes
a property name and a property value. |
public MutablePropertyValues addPropertyValues(PropertyValues other) {
if (other != null) {
PropertyValue[] pvs = other.getPropertyValues();
for (int i = 0; i < pvs.length; i++) {
PropertyValue newPv = new PropertyValue(pvs[i]);
addPropertyValue(newPv);
}
}
return this;
}
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. |
public MutablePropertyValues addPropertyValues(Map other) {
if (other != null) {
Iterator it = other.entrySet().iterator();
while (it.hasNext()) {
Map.Entry entry = (Map.Entry) it.next();
PropertyValue newPv = new PropertyValue((String) entry.getKey(), entry.getValue());
addPropertyValue(newPv);
}
}
return this;
}
Add all property values from the given Map. |
public PropertyValues changesSince(PropertyValues old) {
MutablePropertyValues changes = new MutablePropertyValues();
if (old == this) {
return changes;
}
// for each property value in the new set
for (Iterator it = this.propertyValueList.iterator(); it.hasNext();) {
PropertyValue newPv = (PropertyValue) it.next();
// if there wasn't an old one, add it
PropertyValue pvOld = old.getPropertyValue(newPv.getName());
if (pvOld == null) {
changes.addPropertyValue(newPv);
}
else if (!pvOld.equals(newPv)) {
// it's changed
changes.addPropertyValue(newPv);
}
}
return changes;
}
|
public void clear() {
this.propertyValueList.clear();
}
Clear this holder, removing all PropertyValues. |
public boolean contains(String propertyName) {
return (getPropertyValue(propertyName) != null ||
(this.processedProperties != null && this.processedProperties.contains(propertyName)));
}
|
public boolean equals(Object other) {
if (this == other) {
return true;
}
if (!(other instanceof MutablePropertyValues)) {
return false;
}
MutablePropertyValues that = (MutablePropertyValues) other;
return this.propertyValueList.equals(that.propertyValueList);
}
|
public PropertyValue getPropertyValue(String propertyName) {
for (int i = 0; i < this.propertyValueList.size(); i++) {
PropertyValue pv = (PropertyValue) this.propertyValueList.get(i);
if (pv.getName().equals(propertyName)) {
return pv;
}
}
return null;
}
|
public List getPropertyValueList() {
return this.propertyValueList;
}
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. |
public PropertyValue[] getPropertyValues() {
return (PropertyValue[])
this.propertyValueList.toArray(new PropertyValue[this.propertyValueList.size()]);
}
|
public int hashCode() {
return this.propertyValueList.hashCode();
}
|
public boolean isConverted() {
return this.converted;
}
Return whether this holder contains converted values only (true),
or whether the values still need to be converted (false). |
public boolean isEmpty() {
return this.propertyValueList.isEmpty();
}
|
public void registerProcessedProperty(String propertyName) {
if (this.processedProperties == null) {
this.processedProperties = new HashSet();
}
this.processedProperties.add(propertyName);
}
|
public void removePropertyValue(String propertyName) {
removePropertyValue(getPropertyValue(propertyName));
}
Overloaded version of removePropertyValue that takes a property name. |
public void removePropertyValue(PropertyValue pv) {
this.propertyValueList.remove(pv);
}
Remove the given PropertyValue, if contained. |
public void setConverted() {
this.converted = true;
}
Mark this holder as containing converted values only
(i.e. no runtime resolution needed anymore). |
public void setPropertyValueAt(PropertyValue pv,
int i) {
this.propertyValueList.set(i, pv);
}
Modify a PropertyValue object held in this object.
Indexed from 0. |
public int size() {
return this.propertyValueList.size();
}
|
public String toString() {
PropertyValue[] pvs = getPropertyValues();
StringBuffer sb = new StringBuffer("PropertyValues: length=" + pvs.length + "; ");
sb.append(StringUtils.arrayToDelimitedString(pvs, "; "));
return sb.toString();
}
|