Commented prototype example.
This commit is contained in:
parent
2038d69d92
commit
ed81bcf69b
@ -1,5 +1,12 @@
|
||||
package com.iluwatar;
|
||||
|
||||
/**
|
||||
*
|
||||
* In Prototype we have a factory class (HeroFactoryImpl) producing
|
||||
* objects by cloning existing ones. In this example the factory's
|
||||
* prototype objects are given as constructor parameters.
|
||||
*
|
||||
*/
|
||||
public class App
|
||||
{
|
||||
public static void main( String[] args )
|
||||
|
@ -1,5 +1,10 @@
|
||||
package com.iluwatar;
|
||||
|
||||
/**
|
||||
*
|
||||
* Interface for the factory class.
|
||||
*
|
||||
*/
|
||||
public interface HeroFactory {
|
||||
|
||||
Mage createMage();
|
||||
|
@ -1,5 +1,10 @@
|
||||
package com.iluwatar;
|
||||
|
||||
/**
|
||||
*
|
||||
* Concrete factory class.
|
||||
*
|
||||
*/
|
||||
public class HeroFactoryImpl implements HeroFactory {
|
||||
|
||||
private Mage mage;
|
||||
|
Loading…
x
Reference in New Issue
Block a user