|
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 |
java.lang.Object dk.rode.thesis.observer.PrintSequenceObserver
@Participant(value="ConcreteObserver") public class PrintSequenceObserver
A print sequence observer prints the state of any
observable
sequence it is
observing.
Implementation notes:
The sequenceEvent(Sequence, Sequence.State)
method
is also annotated with the Executor
annotation and
instances of this class can thus also be observers for
AnnotatedObserversSequence
sub-classes or used
directly by the ObserverManager
class.
Field Summary | |
---|---|
private StringablePolicy<Sequence<?>> |
policy
The policy to use to print the observable sequence. |
Constructor Summary | |
---|---|
PrintSequenceObserver()
Constructor. |
|
PrintSequenceObserver(StringablePolicy<Sequence<?>> policy)
Constructor. |
Method Summary | |
---|---|
void |
sequenceEvent(Sequence<?> sequence,
Sequence.State state)
Notification method that is invoked when the sequence supplied as sequence
has changed its state to state . |
String |
toString()
Returns the string representation of this observer. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private final StringablePolicy<Sequence<?>> policy
Can be null, i.e. default policy.
Constructor Detail |
---|
public PrintSequenceObserver()
The default policy for the observable sequence is used.
public PrintSequenceObserver(StringablePolicy<Sequence<?>> policy)
policy
- The policy to use; can be null, i.e. default policy.
NullPointerException
- If out
is null.Method Detail |
---|
@Executor public void sequenceEvent(Sequence<?> sequence, Sequence.State state)
sequence
supplied as sequence
has changed its state to state
.
The type of sequence is not defined; it cannot be assumed
observable
, or even of the type
this observer was attached to; it might be adapted, decorated,
composite, or proxied.
This method is annotated with the Executor
annotation
and can thus also be used to notify instances of this class using
any implementation of AnnotatedObserversSequence
as well.
sequenceEvent
in interface SequenceObserver<Sequence.State>
sequence
- This sequence; cannot be null.state
- The current (new) aspect; cannot be null.public String toString()
toString
in class Object
|
Gunni Rode / rode.dk | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |