uk.org.ogsadai.common.properties
Class SelfNotifyingProperty
java.lang.Object
|
+--java.util.Observable
|
+--uk.org.ogsadai.common.properties.Property
|
+--uk.org.ogsadai.common.properties.SelfNotifyingProperty
- public class SelfNotifyingProperty
- extends Property
A property that automatically notifies its observers whenever
its value changes state.
The value object must be Observable
and each time it
is notified of a change, any observers of the property will also be
notified. In other words, a chain is formed between the observable
value and the property observers. The observable value will be
passed as the argument to the property's
notifiyObservers
method.
Note that the value object of a property of this type cannot be
changed after construction so the setValue
method
raises an UnsupportedOperationException
.
- Author:
- The OGSA-DAI Project Team
Fields inherited from class java.util.Observable |
|
Constructor Summary |
SelfNotifyingProperty(javax.xml.namespace.QName name,
java.util.Observable observableValue)
Create a new property with the specified name and observable value. |
Method Summary |
protected java.util.Observer |
createObserver()
Creates and returns an observer that will automatically notify
observers of the property whenever the property value changes
state. |
java.lang.Object |
getValue()
Return the property value. |
void |
setValue(java.lang.Object value)
Set the property value. |
Methods inherited from class java.util.Observable |
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
COPYRIGHT_NOTICE
private static final java.lang.String COPYRIGHT_NOTICE
- See Also:
- Constant Field Values
mObservableValue
private final java.util.Observable mObservableValue
SelfNotifyingProperty
public SelfNotifyingProperty(javax.xml.namespace.QName name,
java.util.Observable observableValue)
- Create a new property with the specified name and observable value.
When the state of the value changes, any observers of this property
object will be notified.
- Parameters:
name
- The name of the property.observableValue
- The value of the property which must be an observable object.
createObserver
protected java.util.Observer createObserver()
- Creates and returns an observer that will automatically notify
observers of the property whenever the property value changes
state.
- Returns:
- observer.
getValue
public java.lang.Object getValue()
throws PropertyValueException
- Description copied from class:
Property
- Return the property value.
- Specified by:
getValue
in class Property
- Returns:
- the value for the property or
null
if it has not
been set.
- Throws:
PropertyValueException
- if an error occurs when obtaining the
value.
setValue
public void setValue(java.lang.Object value)
- Description copied from class:
Property
- Set the property value.
- Specified by:
setValue
in class Property
- Parameters:
value
- Property value.