com.interface21.beans
Class MutablePropertyValues

java.lang.Object
  |
  +--com.interface21.beans.MutablePropertyValues
All Implemented Interfaces:
PropertyValues

public class MutablePropertyValues
extends java.lang.Object
implements PropertyValues

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
Version:
$Id: MutablePropertyValues.java,v 1.2 2003/02/27 10:10:39 jhoeller Exp $
Author:
Rod Johnson

Constructor Summary
MutablePropertyValues()
          Creates a new empty MutablePropertyValues object.
MutablePropertyValues(java.util.Map map)
          Construct a new PropertyValues object from a Map.
MutablePropertyValues(PropertyValues other)
          Deep copy constructor.
 
Method Summary
 void addPropertyValue(PropertyValue pv)
          Add a PropertyValue object
 PropertyValues changesSince(PropertyValues old)
          Return the changes since the previous PropertyValues.
 boolean contains(java.lang.String propertyName)
          Is there a propertyValue object for this property?
 PropertyValue getPropertyValue(java.lang.String propertyName)
          Return the property value with the given name
 PropertyValue[] getPropertyValues()
          Return an array of the PropertyValue objects held in this object.
 void setPropertyValueAt(PropertyValue pv, int i)
          Modify a PropertyValue object held in this object Indexed from 0
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MutablePropertyValues

public MutablePropertyValues()
Creates a new empty MutablePropertyValues object. PropertyValue objects can be added with the addPropertyValue() method.

MutablePropertyValues

public MutablePropertyValues(PropertyValues other)
Deep copy constructor. Guarantees PropertyValue references are independent, although it can't deep copy objects currently referenced by individual PropertyValue objects

MutablePropertyValues

public MutablePropertyValues(java.util.Map map)
Construct a new PropertyValues object from a Map.
Parameters:
map - Map with property values keyed by property name, which must be a String
Method Detail

addPropertyValue

public void addPropertyValue(PropertyValue pv)
Add a PropertyValue object
Parameters:
pv - PropertyValue object to add

getPropertyValues

public PropertyValue[] getPropertyValues()
Return an array of the PropertyValue objects held in this object.
Specified by:
getPropertyValues in interface PropertyValues
Returns:
an array of the PropertyValue objects held in this object.

contains

public boolean contains(java.lang.String propertyName)
Is there a propertyValue object for this property?
Specified by:
contains in interface PropertyValues
Parameters:
propertyName - name of the property we're interested in
Returns:
whether there is a propertyValue object for this property?

getPropertyValue

public PropertyValue getPropertyValue(java.lang.String propertyName)
Description copied from interface: PropertyValues
Return the property value with the given name
Specified by:
getPropertyValue in interface PropertyValues
Following copied from interface: com.interface21.beans.PropertyValues
Parameters:
propertyName - name to search for
Returns:
pv or null

setPropertyValueAt

public void setPropertyValueAt(PropertyValue pv,
                               int i)
Modify a PropertyValue object held in this object Indexed from 0

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

changesSince

public PropertyValues changesSince(PropertyValues old)
Description copied from interface: PropertyValues
Return the changes since the previous PropertyValues. Subclasses should also override equals.
Specified by:
changesSince in interface PropertyValues
See Also:
PropertyValues.changesSince(PropertyValues)


Rod Johnson and Spring contributors 2001-2003.