- Type Parameters:
O
- The observer type (event listener) observing theObserver
.
- All Known Implementing Classes:
AbstractObservable
public interface Observable<O>
The
Observable
interface can be implemented by any class which can be
observed by Observer
instances (proposal) or any listener interface
(custom as of your needs). Whenever something interesting happens to the
Observable
, then the listeners are informed according to the
Observable
's implementation. Please regard the listener's
documentation on the behavior of the actual listener's methods. Extends it
with further functionality using the Observers
interface.-
Method Summary
Modifier and TypeMethodDescriptionboolean
hasObserverSubscription
(O aObserver) Tests whether the given observer (event listener) has been added to thisObservable
.boolean
subscribeObserver
(O aObserver) Adds the given observer (event listener).boolean
unsubscribeObserver
(O aObserver) Removes the observer (event listener).
-
Method Details
-
hasObserverSubscription
Tests whether the given observer (event listener) has been added to thisObservable
.- Parameters:
aObserver
- The observer (event listener) for which to test if it has been added.- Returns:
- True if the given observer (event listener) has been added already.
-
subscribeObserver
Adds the given observer (event listener). The observer (event listener) itself acts as the handle which is used when removing the given observer (event listener) later.- Parameters:
aObserver
- The observer (event listener) which is to be added to theObservable
.- Returns:
- True if the observer (event listener) has been added successfully. If the observer (event listener) has already been added, false is returned.
-
unsubscribeObserver
Removes the observer (event listener). In case the observer (event listener) has not been added before, then false is returned.- Parameters:
aObserver
- The observer (event listener) which is to be removed.- Returns:
- True if the observer (event listener) has been removed successfully. If there was none such observer (event listener) or if the observer (event listener) has already been removed, then false is returned.
-