public class WeakReferenceObservable extends BaseObservable
IObservable that holds references to Observers as
WeakReferences.
This implementation notifies the observers in a synchronous
fashion. Note that this can cause trouble if you notify the observers while
in a transactional context because the notification is then done also in the
transaction.
This class is based on the work done by Martin Fischer. See references below.
IObservable,
IObserver,
BaseObservable| Constructor and Description |
|---|
WeakReferenceObservable(IObservable observable)
Creates a new WeakReferenceObservable object with a given
IObservable object. |
| Modifier and Type | Method and Description |
|---|---|
void |
addObserver(IObserver observer)
Attaches a observer to the Observable.
|
void |
deleteObserver(IObserver observer)
Detaches a previously attached observer to the observable.
|
countObservers, deleteObservers, getObservers, notifyObservers, notifyObservers, wrappedNotifypublic WeakReferenceObservable(IObservable observable)
IObservable object.observable - the object to observe.public void addObserver(IObserver observer)
IObservableaddObserver in interface IObservableaddObserver in class BaseObservableobserver - The observer to attach to the observablepublic void deleteObserver(IObserver observer)
IObservabledeleteObserver in interface IObservabledeleteObserver in class BaseObservableobserver - The observer to detach from the observableCopyright © 2022. All rights reserved.