dsto.dfc.collections
Class FixedPropertySet

java.lang.Object
  extended by dsto.dfc.collections.FixedPropertySet
All Implemented Interfaces:
PropertySet, Serializable, Cloneable

public class FixedPropertySet
extends Object
implements PropertySet, Serializable, Cloneable

An unmodifiable property set containing a fixed set of values.

Version:
$Revision$
See Also:
Serialized Form

Field Summary
 
Fields inherited from interface dsto.dfc.collections.PropertySet
EMPTY_PROPERTY_SET
 
Constructor Summary
FixedPropertySet(PropertySet set)
          Create a new fixed value property set by copying a source property set.
FixedPropertySet(String[] propertyNames, Object[] propertyValues)
          Create a new property set of fixed values.
 
Method Summary
 void addPropertyChangeListener(PropertyChangeListener l)
           
 void addPropertyValue(String propertyName, Object value)
          Add a values to the end of the list of property values.
 void addPropertyValues(String propertyName, List values)
          Add a set of values to a property.
 Object clone()
           
 Set getPropertyNames()
          The names of defined properties.
 Object getPropertyValue(String propertyName)
          Get the value of a property.
 List getPropertyValues(String propertyName)
          The values of a property.
 boolean hasProperty(String propertyName)
          True if a property has any defined values.
 boolean isModifiable()
          True if property set may be changed.
 void removeAll()
          Undefine all properties in the set
 void removeProperty(String propertyName)
          Remove all values of a property (ie undefine it).
 void removePropertyChangeListener(PropertyChangeListener l)
           
 boolean removePropertyValue(String propertyName, Object value)
          Remove the first occurrence of a value from a list of property values.
 void setPropertyValue(String propertyName, Object value)
           
 void setPropertyValues(String propertyName, List values)
          Set the values of a property.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FixedPropertySet

public FixedPropertySet(String[] propertyNames,
                        Object[] propertyValues)
Create a new property set of fixed values.

Parameters:
propertyNames - The names of the properties in the set.
propertyValues - The values for the properties in the set. Arrays will be returned as multiple values for the property.

FixedPropertySet

public FixedPropertySet(PropertySet set)
Create a new fixed value property set by copying a source property set.

Method Detail

getPropertyNames

public Set getPropertyNames()
Description copied from interface: PropertySet
The names of defined properties.

Specified by:
getPropertyNames in interface PropertySet
Returns:
An immutable set of strings.

getPropertyValues

public List getPropertyValues(String propertyName)
Description copied from interface: PropertySet
The values of a property.

Specified by:
getPropertyValues in interface PropertySet
Parameters:
propertyName - The name of the property.
Returns:
The values for propertyName, or null if no values are defined.

getPropertyValue

public Object getPropertyValue(String propertyName)
Description copied from interface: PropertySet
Get the value of a property. If more than one value exists, the last added value is returned.

Specified by:
getPropertyValue in interface PropertySet

setPropertyValues

public void setPropertyValues(String propertyName,
                              List values)
                       throws UnsupportedOperationException
Description copied from interface: PropertySet
Set the values of a property.

Specified by:
setPropertyValues in interface PropertySet
Throws:
UnsupportedOperationException - if property values cannot be changed.

setPropertyValue

public void setPropertyValue(String propertyName,
                             Object value)
                      throws UnsupportedOperationException
Specified by:
setPropertyValue in interface PropertySet
Throws:
UnsupportedOperationException

removeProperty

public void removeProperty(String propertyName)
                    throws UnsupportedOperationException
Description copied from interface: PropertySet
Remove all values of a property (ie undefine it).

Specified by:
removeProperty in interface PropertySet
Throws:
UnsupportedOperationException - if property values cannot be changed.

hasProperty

public boolean hasProperty(String propertyName)
Description copied from interface: PropertySet
True if a property has any defined values.

Specified by:
hasProperty in interface PropertySet

removeAll

public void removeAll()
               throws UnsupportedOperationException
Description copied from interface: PropertySet
Undefine all properties in the set

Specified by:
removeAll in interface PropertySet
Throws:
UnsupportedOperationException - if property values cannot be changed.

addPropertyValue

public void addPropertyValue(String propertyName,
                             Object value)
                      throws UnsupportedOperationException
Description copied from interface: PropertySet
Add a values to the end of the list of property values.

Specified by:
addPropertyValue in interface PropertySet
Throws:
UnsupportedOperationException - if property values cannot be changed.

addPropertyValues

public void addPropertyValues(String propertyName,
                              List values)
                       throws UnsupportedOperationException
Description copied from interface: PropertySet
Add a set of values to a property.

Specified by:
addPropertyValues in interface PropertySet
Throws:
UnsupportedOperationException - if property values cannot be changed.

removePropertyValue

public boolean removePropertyValue(String propertyName,
                                   Object value)
                            throws UnsupportedOperationException
Description copied from interface: PropertySet
Remove the first occurrence of a value from a list of property values.

Specified by:
removePropertyValue in interface PropertySet
Returns:
True if the property set was changed (ie a value was removed).
Throws:
UnsupportedOperationException - if property values cannot be changed.

isModifiable

public boolean isModifiable()
Description copied from interface: PropertySet
True if property set may be changed.

Specified by:
isModifiable in interface PropertySet

clone

public Object clone()
             throws CloneNotSupportedException
Specified by:
clone in interface PropertySet
Overrides:
clone in class Object
Throws:
CloneNotSupportedException

addPropertyChangeListener

public void addPropertyChangeListener(PropertyChangeListener l)
Specified by:
addPropertyChangeListener in interface PropertySet

removePropertyChangeListener

public void removePropertyChangeListener(PropertyChangeListener l)
Specified by:
removePropertyChangeListener in interface PropertySet


Copyright © 2008 Commonwealth of Australia