|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.modeshape.graph.observe.ChangeObserver
@ThreadSafe public abstract class ChangeObserver
Abstract class that is used to signal that a change set has occurred. This class is typically subclassed by those that wish to
observe changes in content, and registered
with a Observable
.
This class maintains a (weak) reference to the ChangeSource instances with which it is registered. Therefore, the observers
will not keep a ChangeSource from being garbage collected. And, if a change source is garbage collected, calling
unregister()
will clean up naturally.
Nested Class Summary | |
---|---|
protected class |
ChangeObserver.ChangeSourceReference
A WeakReference implementation that provides a valid |
Constructor Summary | |
---|---|
protected |
ChangeObserver()
|
Method Summary | |
---|---|
protected void |
doUnregister()
Method called by unregister() that actually does the unregistering. |
boolean |
isRegistered()
Determine whether this observer is currently registered with any Observable instances. |
abstract void |
notify(Changes changeSet)
Method that is called for each Changes from the Observable instance(s) with which this listener is
registered. |
void |
unregister()
Unregister this listener from all sources that it was registered with. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected ChangeObserver()
Method Detail |
---|
public void unregister()
sources
that it was registered with. This is preferred over calling
Observable.unregister(Observer)
directly.
protected final void doUnregister()
unregister()
that actually does the unregistering. This method is final.
public boolean isRegistered()
Observable
instances.
Although an observer might be registered with an Observable
, if that Observable is garbage collected, then this
observer will no longer be registered with it.
Observable
instance, or false if this observer is not
currently registered with any Observable
instances.public abstract void notify(Changes changeSet)
Changes
from the Observable
instance(s) with which this listener is
registered.
notify
in interface Observer
changeSet
- the change set
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |