|
Evaluating Software Design Patterns — the "Gang of Four" patterns implemented in Java 6 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
O
- The type of observers associated with this observable.A
- The type of aspect associated with this observable.@Participant(value="Subject") public interface AspectObservable<O,A>
An aspect observable object is an object that has a collection of associated observers to be notified in case the object changes its internal state, or aspect, and where the observers can subscribe certain aspects only.
This interface only supplies the logic for
adding
,
removing
, and fetching
associated
observers based on specific aspects, but no notification method
to notify the observers. Using the get, add, and remove methods
from ObservableSequence
gets, subscribes, or removes
regardless of aspect value (all possible aspect values).
Observable
Method Summary | |
---|---|
boolean |
addObserver(O observer,
A aspect)
Adds the observer supplied as observer to this observable for
the aspect supplied as aspect , if not already. |
Set<A> |
getAspects(O observer)
Returns a read-only set of the aspects the observer supplied as observer subscribes to in this observable, if any. |
Collection<O> |
getObservers(A aspect)
Returns the observers subscribed to the aspect supplied as aspect
in this observable. |
boolean |
removeObserver(Object observer,
A aspect)
Removes the observer supplied as observer from this
observable with regards to the aspect supplied as aspect ,
if already added to it. |
Methods inherited from interface dk.rode.thesis.observer.Observable |
---|
addObserver, getObservers, removeObserver |
Method Detail |
---|
boolean addObserver(@Participant(value="ConcreteObserver") O observer, A aspect)
observer
to this observable for
the aspect supplied as aspect
, if not already.
If aspect
is null, observer
will be subscribed
to all possible aspect values.
observer
- The observer to add; cannot be null.aspect
- The aspect to subscribe to; null means all.
observer
was added, false if not.
NullPointerException
- If observer
is null.
IllegalArgumentException
- If observer
is not
a valid observer to add to this observable (optional).removeObserver(Object, Object)
Set<A> getAspects(O observer)
observer
subscribes to in this observable, if any.
observer
- The observer; cannot be null.
NullPointerException
- If observer
is null.Collection<O> getObservers(A aspect)
aspect
in this observable.
aspect
- The aspect; null means all.
aspect
;
never null, but can be empty.boolean removeObserver(Object observer, A aspect)
observer
from this
observable with regards to the aspect supplied as aspect
,
if already added to it. Trying to remove an observer that is not associated with this observable or to an unsubscribed aspect has no effect.
observer
- The observer to remove for aspect
; cannot be null.aspect
- The aspect in question; null means all.
observer
was removed from the subscription
to aspect
(or all if null), false if not.
NullPointerException
- If observer
is null.addObserver(Object, Object)
|
Gunni Rode / rode.dk | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |