Commented prototype example.
This commit is contained in:
		| @@ -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; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user