X Tutup
Skip to content

Commit 2038d69

Browse files
committed
Commented factory method example.
1 parent 427df4e commit 2038d69

File tree

4 files changed

+23
-0
lines changed

4 files changed

+23
-0
lines changed

factory-method/src/main/java/com/iluwatar/App.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
package com.iluwatar;
22

3+
/**
4+
*
5+
* In Factory Method we have an interface (Blacksmith) with a
6+
* method for creating objects (manufactureWeapon). The concrete
7+
* subclasses (OrcBlacksmith, ElfBlacksmith) then override the
8+
* method to produce objects of their liking.
9+
*
10+
*/
311
public class App
412
{
513
public static void main( String[] args )

factory-method/src/main/java/com/iluwatar/Blacksmith.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
package com.iluwatar;
22

3+
/**
4+
*
5+
* The interface containing method for producing objects.
6+
*
7+
*/
38
public interface Blacksmith {
49

510
Weapon manufactureWeapon(WeaponType weaponType);

factory-method/src/main/java/com/iluwatar/ElfBlacksmith.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
package com.iluwatar;
22

3+
/**
4+
*
5+
* Concrete subclass for creating new objects.
6+
*
7+
*/
38
public class ElfBlacksmith implements Blacksmith {
49

510
public Weapon manufactureWeapon(WeaponType weaponType) {

factory-method/src/main/java/com/iluwatar/OrcBlacksmith.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
package com.iluwatar;
22

3+
/**
4+
*
5+
* Concrete subclass for creating new objects.
6+
*
7+
*/
38
public class OrcBlacksmith implements Blacksmith {
49

510
public Weapon manufactureWeapon(WeaponType weaponType) {

0 commit comments

Comments
 (0)
X Tutup