Evaluating Software Design Patterns
— the "Gang of Four" patterns implemented in Java 6

dk.rode.thesis.factorymethod
Class SequenceCommandCreator<E>

java.lang.Object
  extended by dk.rode.thesis.factorymethod.CommandCreator<E,Sequence.State>
      extended by dk.rode.thesis.factorymethod.SequenceCommandCreator<E>
Type Parameters:
E - The type of values delivered by created commands (and thus sequences).
Direct Known Subclasses:
EvilSequenceCommandCreator, ReversibleSequenceCommandCreator

@Participant(value="ConcreteCreator")
public class SequenceCommandCreator<E>
extends CommandCreator<E,Sequence.State>

A standard command creator creates new commands based on sequence states as tokens.

This creator can create the following commands based on the supplied internal sequence state:

A sequence command creator is stateless and thread-safe.

Author:
Gunni Rode / rode.dk

Constructor Summary
SequenceCommandCreator()
          No-arg constructor.
 
Method Summary
protected  Command<E> create(Sequence<E> sequence, Sequence.State state)
          Factory method to create a new command of the type specified by the token supplied as token.
 
Methods inherited from class dk.rode.thesis.factorymethod.CommandCreator
createDefault, equals, getCommand, hashCode, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SequenceCommandCreator

public SequenceCommandCreator()
No-arg constructor.

Method Detail

create

protected Command<E> create(Sequence<E> sequence,
                            Sequence.State state)
                     throws Exception
Description copied from class: CommandCreator
Factory method to create a new command of the type specified by the token supplied as token.

The sequence set as the receiver is supplied as sequence.

Specified by:
create in class CommandCreator<E,Sequence.State>
Parameters:
sequence - The sequence; never null.
state - The token identifying the type of command to create; can be null.
Returns:
The corresponding command, or null if no such command could be created. If null is returned, a default (on null) command is returned by CommandCreator.getCommand(Sequence, Object).
Throws:
Exception - If the creation fails; if so, a default (or null) command will be returned by getCommand.
See Also:
CommandCreator.createDefault(Sequence)

Gunni Rode / rode.dk

Feel free to use and/or modify the Java 6 source code developed for this thesis AT YOUR OWN RISK, but note that the source code comes WITHOUT ANY — and I do mean WITHOUT ANY — form of warranty WHAT SO EVER!

The original thesis and source code are available at rode.dk/thesis.