|
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.Objectdk.rode.thesis.decorator.SequenceDecorator<String>
dk.rode.thesis.decorator.UppercaseDecorator
@Participant(value="ConcreteDecorator") public class UppercaseDecorator
An upper-case sequence decorator returns the string value
returned by the decorated sequence in upper-case, for example
a -> A.
A flag can be supplied at construction time which specifies if
only the first character from the string value should be
upper-cased, i.e. aaa -> Aaa as opposed to
aaa -> AAA (default).
Only sequences returning strings can be decorated.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface dk.rode.thesis.meta.model.Sequence |
|---|
Sequence.State |
| Field Summary | |
|---|---|
private boolean |
firstOnly
True if only the first character in the sequence value should be upper-cased, false if the entire value should be upper-cased. |
| Fields inherited from class dk.rode.thesis.decorator.SequenceDecorator |
|---|
sequence |
| Constructor Summary | |
|---|---|
UppercaseDecorator(Sequence<String> sequence)
Constructor. |
|
UppercaseDecorator(Sequence<String> sequence,
boolean firstOnly)
Constructor. |
|
| Method Summary | |
|---|---|
UppercaseDecorator |
copy()
Returns a copy of this sequence that will start at the same sequence index as this sequence. |
String |
current()
Returns the current element from this sequence. |
String |
next()
Returns the next element from this sequence. |
private static String |
toUpperCase(String value,
boolean firstOnly)
Returns an upper-cased string based on value. |
| Methods inherited from class dk.rode.thesis.decorator.SequenceDecorator |
|---|
bounded, consistent, equals, getSequence, getStringablePolicy, hashCode, reset, state, toString, toString, unique |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface dk.rode.thesis.meta.model.Sequence |
|---|
bounded, consistent, reset, state, unique |
| Methods inherited from interface dk.rode.thesis.strategy.Stringable |
|---|
getStringablePolicy, toString |
| Field Detail |
|---|
private final boolean firstOnly
| Constructor Detail |
|---|
public UppercaseDecorator(@Participant(value="ConcreteComponent")
Sequence<String> sequence)
The entire sequence value (String) will be upper-cased.
sequence - The sequence to decorate; cannot be null.
NullPointerException - If sequence is null.
public UppercaseDecorator(@Participant(value="ConcreteComponent")
Sequence<String> sequence,
boolean firstOnly)
If firstOnly is true, only the first character
in the values delivered by sequence will be
upper-cased.
sequence - The sequence to decorate; cannot be null.firstOnly - True if only the first character should
be upper-cased, false for the entire
value.
NullPointerException - If sequence is null.| Method Detail |
|---|
public UppercaseDecorator copy()
Sequence
copy in interface Sequence<String>copy in interface Copyable<Sequence<String>>public String current()
Sequence
This method can be invoked even if Sequence.next()
has not been invoked yet, thus delivering the initial
value of this sequence.
current in interface Sequence<String>current in class SequenceDecorator<String>public String next()
Sequence
next in interface Sequence<String>next in class SequenceDecorator<String>Sequence.current(),
Sequence.state()
private static final String toUpperCase(String value,
boolean firstOnly)
value.
value - The value to upper-case (first); never null.firstOnly - True if only the first character in
value should be upper-cased.
|
Gunni Rode / rode.dk | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||