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

dk.rode.thesis.abstractfactory
Class PrototypicalSequenceFactory<E>

java.lang.Object
  extended by dk.rode.thesis.abstractfactory.PrototypicalFactory<Sequence<E>>
      extended by dk.rode.thesis.abstractfactory.PrototypicalSequenceFactory<E>
Type Parameters:
E - The type of values delivered by the created sequences.
All Implemented Interfaces:
SequenceFactory<E,Void>

@ParticipantUsage(value="ConcreteProduct",
                  type=Sequence.class)
@Participant(value="ConcreteFactory")
public class PrototypicalSequenceFactory<E>
extends PrototypicalFactory<Sequence<E>>
implements SequenceFactory<E,Void>

A prototypical sequence factory creates sequences based on a prototype supplied at construction time.

This factory is thread-safe.

Author:
Gunni Rode / rode.dk
See Also:
StandardFactory

Constructor Summary
PrototypicalSequenceFactory(Sequence<E> prototype)
          Constructor.
 
Method Summary
 Sequence<E> create()
          Creates a new instance based on the prototypical object supplied at construction time.
 Sequence<E> createSequence(Void unused)
          Creates a new initialised sequence instance.
 
Methods inherited from class dk.rode.thesis.abstractfactory.PrototypicalFactory
toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PrototypicalSequenceFactory

public PrototypicalSequenceFactory(Sequence<E> prototype)
Constructor.

prototype is copied and this factory keeps no reference to it.

Parameters:
prototype - The prototypical sequence to use; cannot be null.
Throws:
NullPointerException - If prototype is null.
Method Detail

create

public Sequence<E> create()
Description copied from class: PrototypicalFactory
Creates a new instance based on the prototypical object supplied at construction time.

Overrides:
create in class PrototypicalFactory<Sequence<E>>
Returns:
The new instance; never null.

createSequence

public Sequence<E> createSequence(Void unused)
Description copied from interface: SequenceFactory
Creates a new initialised sequence instance.

Specified by:
createSequence in interface SequenceFactory<E,Void>
Parameters:
unused - Never used.
Returns:
A new sequence instance; never null.

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.