com.virtuosotechnologies.lib.container
Class PseudoModifiablePropertySet

java.lang.Object
  extended bycom.virtuosotechnologies.lib.container.PseudoModifiablePropertySet
All Implemented Interfaces:
PropertySet
Direct Known Subclasses:
BasicModifiablePropertySet

public class PseudoModifiablePropertySet
extends Object
implements PropertySet

A PropertySet that implements methods of ModifiablePropertySet without implementing the ModifiablePropertySet interface. This is useful for implementations that don't want to export objects that appear to be modifiable.

This implementation is fully synchronized and thread-safe. However, note that it may be used in larger implementations that are not thread-safe.


Constructor Summary
PseudoModifiablePropertySet()
          Constructor
PseudoModifiablePropertySet(PropertySet parent)
          Constructor with parent.
 
Method Summary
 void addPropertySetListener(PropertySetListener listener)
          Add a PropertySetListener.
protected  void firePropertySetEvent(ConstrainedKey key, Object oldValue, Object newValue, boolean isSourceOriginal)
          Fires a property set event
 Object getDefaultValue(ConstrainedKey key)
          Get the default value for a property, or null if there is no default.
 Object getValue(ConstrainedKey key)
          Get a property.
 void putValue(ConstrainedKey key, Object value)
          Set a property.
 void removePropertySetListener(PropertySetListener listener)
          Remove a PropertySetListener.
 void resetValue(ConstrainedKey key)
          Reset a property to the default.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PseudoModifiablePropertySet

public PseudoModifiablePropertySet()
Constructor


PseudoModifiablePropertySet

public PseudoModifiablePropertySet(PropertySet parent)
Constructor with parent.

Parameters:
parent - parent PropertySet providing default values
Method Detail

getValue

public Object getValue(ConstrainedKey key)
Get a property.

Specified by:
getValue in interface PropertySet
Parameters:
key - key object for the property
Returns:
value for the property

getDefaultValue

public Object getDefaultValue(ConstrainedKey key)
Get the default value for a property, or null if there is no default.

Specified by:
getDefaultValue in interface PropertySet
Parameters:
key - key object for the property
Returns:
default value for the property

putValue

public void putValue(ConstrainedKey key,
                     Object value)
Set a property.

Parameters:
key - key object for the property.
value - new value for the property.

resetValue

public void resetValue(ConstrainedKey key)
Reset a property to the default. Sets it to null if there is no default.

Parameters:
key - key object for the property

addPropertySetListener

public final void addPropertySetListener(PropertySetListener listener)
Add a PropertySetListener. Listeners should be added via weak references.

Specified by:
addPropertySetListener in interface PropertySet
Parameters:
listener - new listener

removePropertySetListener

public final void removePropertySetListener(PropertySetListener listener)
Remove a PropertySetListener. Does nothing if the listener is not already present.

Specified by:
removePropertySetListener in interface PropertySet
Parameters:
listener - listener to remove

firePropertySetEvent

protected final void firePropertySetEvent(ConstrainedKey key,
                                          Object oldValue,
                                          Object newValue,
                                          boolean isSourceOriginal)
Fires a property set event