com.xmlmind.util
Class PropertySet

java.lang.Object
  extended by com.xmlmind.util.PropertySet

public abstract class PropertySet
extends java.lang.Object

Base class for objects which can have a set of properties.

The implementation attempts to spare memory as much as possible because it assumes that most objects will have no properties at all.

This class is not thread-safe.


Constructor Summary
PropertySet()
           
 
Method Summary
 java.util.Iterator<java.lang.Object[]> getProperties()
          Returns an Iterator of the properties contained in this property set.
 java.lang.Object getProperty(java.lang.Object key)
          Returns the value of specified property.
 int getPropertyCount()
          Returns the number of properties contained in this property set.
 boolean hasProperty(java.lang.Object key)
          Tests if this property set contains specified property.
 void putProperties(PropertySet other)
          Adds (or replaces) all the properties found in specified set.
 java.lang.Object putProperty(java.lang.Object key, java.lang.Object value)
          Adds or replaces a property.
 void removeAllProperties()
          Removes all properties from set.
 java.lang.Object removeProperty(java.lang.Object key)
          Removes a property.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PropertySet

public PropertySet()
Method Detail

putProperties

public void putProperties(PropertySet other)
Adds (or replaces) all the properties found in specified set.

Parameters:
other - contains the properties to be added to this set

putProperty

public java.lang.Object putProperty(java.lang.Object key,
                                    java.lang.Object value)
Adds or replaces a property.

Parameters:
key - the property name
value - the property value
Returns:
previous property value if property has been replaced or null if property has been added

removeProperty

public java.lang.Object removeProperty(java.lang.Object key)
Removes a property.

Parameters:
key - the property name
Returns:
previous property value if property has been removed or null otherwise

removeAllProperties

public void removeAllProperties()
Removes all properties from set.


hasProperty

public boolean hasProperty(java.lang.Object key)
Tests if this property set contains specified property.

Parameters:
key - the property name
Returns:
true if this property set contains the specified property and false otherwise.

getProperty

public java.lang.Object getProperty(java.lang.Object key)
Returns the value of specified property.

Parameters:
key - the property name
Returns:
the value of the property if found and null otherwise.

getPropertyCount

public int getPropertyCount()
Returns the number of properties contained in this property set.

Returns:
the number of properties contained in this property set

getProperties

public java.util.Iterator<java.lang.Object[]> getProperties()
Returns an Iterator of the properties contained in this property set. This iterator does not support the remove operation.

Returns:
an Iterator over the properties contained in this property set