Added comments for Abstract Factory example.
This commit is contained in:
		| @@ -1,5 +1,14 @@ | ||||
| package com.iluwatar; | ||||
|  | ||||
| /** | ||||
|  *  | ||||
|  * The essence of the Abstract Factory pattern is a factory interface (KingdomFactory) | ||||
|  * and its implementations (ElfKingdomFactory, OrcKingdomFactory). | ||||
|  *  | ||||
|  * The example uses both concrete implementations to create a king, a castle and an | ||||
|  * army. | ||||
|  * | ||||
|  */ | ||||
| public class App  | ||||
| { | ||||
|     public static void main( String[] args ) | ||||
|   | ||||
| @@ -1,5 +1,10 @@ | ||||
| package com.iluwatar; | ||||
|  | ||||
| /** | ||||
|  *  | ||||
|  * Concrete factory. | ||||
|  * | ||||
|  */ | ||||
| public class ElfKingdomFactory implements KingdomFactory { | ||||
|  | ||||
| 	public Castle createCastle() { | ||||
|   | ||||
| @@ -1,5 +1,10 @@ | ||||
| package com.iluwatar; | ||||
|  | ||||
| /** | ||||
|  *  | ||||
|  * The factory interface. | ||||
|  * | ||||
|  */ | ||||
| public interface KingdomFactory { | ||||
|  | ||||
| 	Castle createCastle(); | ||||
|   | ||||
| @@ -1,5 +1,10 @@ | ||||
| package com.iluwatar; | ||||
|  | ||||
| /** | ||||
|  *  | ||||
|  * Concrete factory. | ||||
|  * | ||||
|  */ | ||||
| public class OrcKingdomFactory implements KingdomFactory { | ||||
|  | ||||
| 	public Castle createCastle() { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user