|
Evaluating Software Design Patterns — the "Gang of Four" patterns implemented in Java 6 |
||||||||
PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES |
See:
Description
Class Summary | |
---|---|
AppenderDecorator | An appender decorator returns the String value from a decorated sequence prefixed and/or postfixed with values supplied at construction time, respectively. |
DuplexDecorator | A duplex sequence decorator returns the String value
returned by the decorated sequence concatenated with
the same value, for example x -> xx . |
Main | Decorator tests. |
SequenceDecorator<E> | A sequence decorator is a decorator that forwards all
request to the decorated Sequence without performing
additional operations except for toString() . |
UppercaseDecorator | An upper-case sequence decorator returns the string value
returned by the decorated sequence in upper-case, for example
a -> A . |
Enum Summary | |
---|---|
DecoratedPolicy | Additional policies for formatting decorated
sequences into char sequences (not part of the core Decorator
implementation). |
Implementations and examples of the Decorator design pattern [Gamma95, p.175].
Intent:
Attach additional responsibilities to an object dynamically. Decorators provide a flexible alternative to sub—classing for extending functionality.
Sequence
interface.
Any Sequence
implementation thus represent the
ConcreteComponent participant.
The Decorator participant is represented by the abstract
SequenceDecorator
class,
which also implements the Sequence
interface as required.
It implements all the basic Sequence
functionality by
forwarding calls to the decorated sequence. This package defines
several decorators that represent the ConcreteDecorator
participant, for example AppenderDecorator
and DuplexDecorator
.
Implementation notes:
All the decorators defined here only adds behaviour, no additional state.
|
Gunni Rode / rode.dk | ||||||||
PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES |