Package org.apache.ofbiz.base.util
Class Observable
java.lang.Object
org.apache.ofbiz.base.util.Observable
An observable object.
This class is similar to java.util.Observable
but it has some differences:
- It has improved concurrency
- It cannot be subclassed
- The
notifyObservers
method does not clear the changed flag - Protected methods have been made public
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addObserver
(Observer observer) Adds an observer to the set of observers for this object.void
Clears the changed flag.void
deleteObserver
(Observer observer) Deletes an observer from the set of observers of this object.void
Clears the observer list so that this object no longer has any observers.boolean
Returnstrue
if this object has changed.void
Notify all of the observers.void
notifyObservers
(Object arg) Notify all of the observers.void
Sets the changed flag totrue
.
-
Constructor Details
-
Observable
public Observable() -
Observable
-
-
Method Details
-
addObserver
Adds an observer to the set of observers for this object.- Parameters:
observer
- the observer to be added.
-
clearChanged
public void clearChanged()Clears the changed flag. -
deleteObserver
Deletes an observer from the set of observers of this object. Passingnull
to this method will have no effect.- Parameters:
observer
- the observer to be deleted.
-
deleteObservers
public void deleteObservers()Clears the observer list so that this object no longer has any observers. -
hasChanged
public boolean hasChanged()Returnstrue
if this object has changed. -
notifyObservers
public void notifyObservers()Notify all of the observers.Each
Observer
has itsupdate
method called with two arguments: this observable object andnull
. In other words, this method is equivalent to:notifyObservers(null)
-
notifyObservers
Notify all of the observers.Each observer has its
update
method called with two arguments: this observable object and thearg
argument. -
setChanged
public void setChanged()Sets the changed flag totrue
.
-