File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed
abstract-factory/src/main/java/com/iluwatar/abstractfactory Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ public class App {
2323 private Castle castle ;
2424 private Army army ;
2525
26+
2627 /**
2728 * Creates kingdom
2829 *
@@ -77,4 +78,33 @@ public Army getArmy() {
7778 private void setArmy (final Army army ) {
7879 this .army = army ;
7980 }
81+
82+
83+ /**
84+ * Program entry point
85+ *
86+ * @param args command line args
87+ */
88+ public static void main (String [] args ) {
89+
90+ App app = new App ();
91+
92+ System .out .println ("Elf Kingdom" );
93+ KingdomFactory elfKingdomFactory ;
94+ elfKingdomFactory = app .getElfKingdomFactory ();
95+ app .createKingdom (elfKingdomFactory );
96+ System .out .println (app .getArmy ().getDescription ());
97+ System .out .println (app .getCastle ().getDescription ());
98+ System .out .println (app .getKing ().getDescription ());
99+
100+ System .out .println ("\n Orc Kingdom" );
101+ KingdomFactory orcKingdomFactory ;
102+ orcKingdomFactory = app .getOrcKingdomFactory ();
103+ app .createKingdom (orcKingdomFactory );
104+ System .out .println (app .getArmy ().getDescription ());
105+ System .out .println (app .getCastle ().getDescription ());
106+ System .out .println (app .getKing ().getDescription ());
107+
108+ }
109+
80110}
You can’t perform that action at this time.
0 commit comments