Applied Design Patterns with Java

Creational :: Prototype (117) {C ch 8}

Example - UML : Swimmer

Example - Java :: Patterns\Creational\Prototype

Pattern Concept: to specify the general class needed, but defer specifying the exact class needed until run time. The needed classes are constructed by cloning them and then revising as needed. Java has a Cloneable interface, with an Object.clone() method. The example makes use of this 'shallow copy' technique.

Consequences and issues of the Prototype pattern include:

The example Java program is called 'Swimmer'.

The UML diagram is above, and the list of Java files is below:

Catalog Creational Prev Next