uk.org.ogsadai.common.properties
Class SelfUpdatingProperty
java.lang.Object
|
+--java.util.Observable
|
+--uk.org.ogsadai.common.properties.Property
|
+--uk.org.ogsadai.common.properties.SelfUpdatingProperty
- public class SelfUpdatingProperty
- extends Property
A property that updates its value automatically whenever a specified object changes state.
The specified object is Observable
The new property value will be the argument passed to the notifyObservers
method of the Observable
object. This in turn will be passed to the observers of this property.
- Author:
- The OGSA-DAI Project Team
Fields inherited from class java.util.Observable |
|
Constructor Summary |
SelfUpdatingProperty(javax.xml.namespace.QName name, java.lang.Object initialValue, java.util.Observable observable)
Create a new property with the specified name and initial 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
mValue
private java.lang.Object mValue
-
mObservable
private final java.util.Observable mObservable
-
SelfUpdatingProperty
public SelfUpdatingProperty(javax.xml.namespace.QName name,
java.lang.Object initialValue,
java.util.Observable observable)
-
Create a new property with the specified name and initial value. The value will be updated whenever the specified observable object notifies its observers of a change of state.
- Parameters:
name
- The name of the property.
initialValue
- The initial value for the property.
observable
- The observable object that will govern when the property value is updated.
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.