File tree Expand file tree Collapse file tree 4 files changed +23
-0
lines changed
factory-method/src/main/java/com/iluwatar Expand file tree Collapse file tree 4 files changed +23
-0
lines changed Original file line number Diff line number Diff line change 11package 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+ */
311public class App
412{
513 public static void main ( String [] args )
Original file line number Diff line number Diff line change 11package com .iluwatar ;
22
3+ /**
4+ *
5+ * The interface containing method for producing objects.
6+ *
7+ */
38public interface Blacksmith {
49
510 Weapon manufactureWeapon (WeaponType weaponType );
Original file line number Diff line number Diff line change 11package com .iluwatar ;
22
3+ /**
4+ *
5+ * Concrete subclass for creating new objects.
6+ *
7+ */
38public class ElfBlacksmith implements Blacksmith {
49
510 public Weapon manufactureWeapon (WeaponType weaponType ) {
Original file line number Diff line number Diff line change 11package com .iluwatar ;
22
3+ /**
4+ *
5+ * Concrete subclass for creating new objects.
6+ *
7+ */
38public class OrcBlacksmith implements Blacksmith {
49
510 public Weapon manufactureWeapon (WeaponType weaponType ) {
You can’t perform that action at this time.
0 commit comments