Class ObservableProperties<T>

java.lang.Object
org.jjazz.utilities.api.ObservableProperties<T>
Type Parameters:
T -
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
StringProperties

public class ObservableProperties<T> extends Object implements Serializable
Properties which can be listened to.

A PropertyChangeEvent with name=propertyName is fired when property value is changed or set to null (i.e removed).

See Also:
  • Constructor Details

    • ObservableProperties

      public ObservableProperties()
    • ObservableProperties

      public ObservableProperties(Object owner)
      Parameters:
      owner - Can be null
    • ObservableProperties

      public ObservableProperties(Object owner, ObservableProperties<T> otherProperties)
      Parameters:
      owner - Can be null
      otherProperties -
  • Method Details

    • getOwner

      public Object getOwner()
      The (optional) owner of this properties.
      Returns:
      Can be null
    • put

      public void put(String propertyName, T value)
      Put a client property.

      Fire a PropertyChangeEvent using propertyName.

      Parameters:
      propertyName -
      value - If null the property is removed.
    • get

      public T get(String propertyName)
      Get a client property.
      Parameters:
      propertyName -
      Returns:
      Can be null.
    • get

      public T get(String propertyName, T defaultValue)
      Get a client property.
      Parameters:
      propertyName -
      defaultValue - Default value to be returned if propertyName is not defined.
      Returns:
    • set

      public final void set(ObservableProperties<T> other)
      Replace the current properties by the properties from otherProperties.

      Fire 0, 1 or more client property change events as required.

      Parameters:
      other -
    • getPropertyNames

      public Set<String> getPropertyNames()
      Get all property names.
      Returns:
    • clear

      public void clear()
      Remove all client properties.

      This will fire one or more PropertyChangeEvents.

    • addPropertyChangeListener

      public void addPropertyChangeListener(PropertyChangeListener listener)
    • removePropertyChangeListener

      public void removePropertyChangeListener(PropertyChangeListener listener)
    • addPropertyChangeListener

      public void addPropertyChangeListener(String property, PropertyChangeListener listener)
    • removePropertyChangeListener

      public void removePropertyChangeListener(String property, PropertyChangeListener listener)