uk.org.ogsadai.common.properties
Class CallbackSelfNotifyingProperty
java.lang.Object
|
+--java.util.Observable
|
+--uk.org.ogsadai.common.properties.Property
|
+--uk.org.ogsadai.common.properties.CallbackSelfNotifyingProperty
- public class CallbackSelfNotifyingProperty
- 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 |
|
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
mObservable
private final java.util.Observable mObservable
mValueCallback
private final PropertyValue mValueCallback
CallbackSelfNotifyingProperty
public CallbackSelfNotifyingProperty(javax.xml.namespace.QName name,
java.util.Observable observable,
PropertyValue value)
- 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.observable
- The observed value.value
- The value of the property.
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.