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

Class PrototypicalAbstractionFactory<E>

  extended by dk.rode.thesis.abstractfactory.PrototypicalAbstractionFactory<E>
Type Parameters:
E - The type of values delivered by the created abstractions.
All Implemented Interfaces:

public class PrototypicalAbstractionFactory<E>
extends Object
implements AbstractionFactory<E>

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

Created abstractions will be initialised if the prototype supplied at construction time was initialised.

This factory is thread-safe.

Gunni Rode / rode.dk
See Also:
MemorizableAbstractionFactory, SynchronisedAbstractionFactory

Field Summary
private  SequenceAbstraction<E> prototype
          The prototypical sequence abstraction to use.
Constructor Summary
PrototypicalAbstractionFactory(SequenceAbstraction<E> prototype)
Method Summary
 SequenceAbstraction<E> createAbstraction()
          Creates a new sequence abstraction instance.
 String toString()
          Returns the string representation of this factory.
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

Field Detail


private final SequenceAbstraction<E> prototype
The prototypical sequence abstraction to use.

The abstraction may or may not have been initialised.

Never null.

Constructor Detail


public PrototypicalAbstractionFactory(SequenceAbstraction<E> prototype)

The abstraction supplied as prototype is copied, so modifying it from an external context will not affect this factory (unless prototype is a singleton). This factory will not change prototype.

prototype - The prototypical abstraction to use; cannot be null.
NullPointerException - If prototype is null.
Method Detail


public SequenceAbstraction<E> createAbstraction()
Description copied from interface: AbstractionFactory
Creates a new sequence abstraction instance.

Depending on the actual factory implementation, the returned abstraction may be initialised. If so, no implementation need be set.

Specified by:
createAbstraction in interface AbstractionFactory<E>
A new sequence abstraction instance; never null.


public String toString()
Returns the string representation of this factory.

toString in class Object
The string representation; 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.