Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.modeshape.graph.observe
Class ChangeObserver

    java.lang.Object
      org.modeshape.graph.observe.ChangeObserver

All Implemented Interfaces:
  Observer

Direct Known Subclasses:
  NetChangeObserver

    @ThreadSafe
    public abstract class ChangeObserver

extends Object
implements Observer

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

### ChangeObserver

    protected ChangeObserver()

Method Detail

### unregister

    public void unregister()

  Unregister this listener from all `sources` that it was registered with. This is preferred over calling `Observable.unregister(Observer)` directly.

### doUnregister

    protected final void doUnregister()

  Method called by `unregister()` that actually does the unregistering. This method is final.

### isRegistered

    public boolean isRegistered()

  Determine whether this observer is currently registered with any `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.

  Returns:
    true if this observer is registered with at least one `Observable` instance, or false if this observer is not currently registered with any `Observable` instances.

### notify

    public abstract void notify(Changes changeSet)

  Method that is called for each `Changes` from the `Observable` instance(s) with which this listener is registered.

  Specified by:
    `notify` in interface `Observer`
  Parameters:
    `changeSet` - the change set

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2008-2012 JBoss, a division of Red Hat. All Rights Reserved.