public interface IObservable
By providing Observable as an interface, instead of the JDK'a
Observable class, client classes have the option to mimic
multiple inheritance by means of a delegate pattern which uses an inner
private class which implements this interface.
This class is based on the work done by Martin Fischer, with only minor changes. See references below.
| Modifier and Type | Method and Description |
|---|---|
void |
addObserver(IObserver observer)
Attaches a observer to the Observable.
|
int |
countObservers()
Counts how many Observers were attached to this class.
|
void |
deleteObserver(IObserver observer)
Detaches a previously attached observer to the observable.
|
void |
deleteObservers()
Detaches all previously attached observer to the observable.
|
List<IObserver> |
getObservers()
Returns list of observers registered with the Observable.
|
void |
notifyObservers()
Notifies all attached observers about changes in the observable.
|
void |
notifyObservers(Object arg)
Notifies all attached observers about changes in the observable.
|
void addObserver(IObserver observer)
observer - The observer to attach to the observableint countObservers()
IObserverList<IObserver> getObservers()
void deleteObserver(IObserver observer)
observer - The observer to detach from the observablevoid deleteObservers()
void notifyObservers()
void notifyObservers(Object arg)
arg - an arbitrary Object to be passed to the ObserverCopyright © 2022. All rights reserved.