Package org.jjazz.utilities.api
Class ObservableProperties<T>
java.lang.Object
org.jjazz.utilities.api.ObservableProperties<T>
- Type Parameters:
T
-
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
StringProperties
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 Summary
ConstructorDescriptionObservableProperties
(Object owner) ObservableProperties
(Object owner, ObservableProperties<T> otherProperties) -
Method Summary
Modifier and TypeMethodDescriptionvoid
void
addPropertyChangeListener
(String property, PropertyChangeListener listener) void
clear()
Remove all client properties.Get a client property.Get a client property.getOwner()
The (optional) owner of this properties.Get all property names.void
Put a client property.void
void
removePropertyChangeListener
(String property, PropertyChangeListener listener) final void
set
(ObservableProperties<T> other) Replace the current properties by the properties from otherProperties.
-
Constructor Details
-
ObservableProperties
public ObservableProperties() -
ObservableProperties
- Parameters:
owner
- Can be null
-
ObservableProperties
- Parameters:
owner
- Can be nullotherProperties
-
-
-
Method Details
-
getOwner
The (optional) owner of this properties.- Returns:
- Can be null
-
put
Put a client property.Fire a PropertyChangeEvent using propertyName.
- Parameters:
propertyName
-value
- If null the property is removed.
-
get
Get a client property.- Parameters:
propertyName
-- Returns:
- Can be null.
-
get
Get a client property.- Parameters:
propertyName
-defaultValue
- Default value to be returned if propertyName is not defined.- Returns:
-
set
Replace the current properties by the properties from otherProperties.Fire 0, 1 or more client property change events as required.
- Parameters:
other
-
-
getPropertyNames
Get all property names.- Returns:
-
clear
public void clear()Remove all client properties.This will fire one or more PropertyChangeEvents.
-
addPropertyChangeListener
-
removePropertyChangeListener
-
addPropertyChangeListener
-
removePropertyChangeListener
-