net.nexttext
Class PropertySet

java.lang.Object
  extended by net.nexttext.PropertySet

public class PropertySet
extends java.lang.Object

The PropertySet encapsulates the named properties of an object.

The PropertySet is a map from property names to Property objects. It is similar to java.util.Map, except that once a Property object has been added to the PropertySet that object cannot be removed or replaced, the name will always map to the very same Property object. Making the Properties static in this way makes it easier to write code which uses Properties. It allows original Property values to be stored correctly, it reduces the number of checks that have to be done in behaviours, and means that concurrent access is feasible.


Constructor Summary
PropertySet()
           
 
Method Summary
 Property get(java.lang.String name)
          Get the named property, null if it's not there.
 java.util.Set<java.lang.String> getNames()
          Names of all the properties, in an unmodifiable set.
 void init(java.util.Map<java.lang.String,Property> properties)
          Initialize all the properties in the map, if not already defined.
 void init(java.lang.String name, Property value)
          Initialize the property with this value, if it's not already defined.
 void reset()
          Resets all the properties to their original value.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PropertySet

public PropertySet()
Method Detail

init

public void init(java.lang.String name,
                 Property value)
Initialize the property with this value, if it's not already defined.

The provided property is cloned before it is added to the property list.


init

public void init(java.util.Map<java.lang.String,Property> properties)
Initialize all the properties in the map, if not already defined.

See initProperty(String, Property). Map keys must be Strings, values must be Properties.


get

public Property get(java.lang.String name)
Get the named property, null if it's not there.


getNames

public java.util.Set<java.lang.String> getNames()
Names of all the properties, in an unmodifiable set.


reset

public void reset()
Resets all the properties to their original value.