2424package com .iluwatar .abstractfactory ;
2525
2626import com .iluwatar .abstractfactory .App .FactoryMaker .KingdomType ;
27+ import lombok .Getter ;
28+ import lombok .Setter ;
29+ import lombok .extern .slf4j .Slf4j ;
2730import org .slf4j .Logger ;
2831import org .slf4j .LoggerFactory ;
2932
4144 * and its implementations ( {@link ElfKingdomFactory}, {@link OrcKingdomFactory}). The example uses
4245 * both concrete implementations to create a king, a castle and an army.
4346 */
47+ @ Slf4j
4448public class App {
4549
46- private static final Logger LOGGER = LoggerFactory . getLogger ( App . class );
47-
50+ @ Setter
51+ @ Getter
4852 private King king ;
53+
54+ @ Setter
55+ @ Getter
4956 private Castle castle ;
57+
58+ @ Setter
59+ @ Getter
5060 private Army army ;
5161
5262 /**
@@ -58,30 +68,6 @@ public void createKingdom(final KingdomFactory factory) {
5868 setArmy (factory .createArmy ());
5969 }
6070
61- public King getKing () {
62- return king ;
63- }
64-
65- private void setKing (final King king ) {
66- this .king = king ;
67- }
68-
69- public Castle getCastle () {
70- return castle ;
71- }
72-
73- private void setCastle (final Castle castle ) {
74- this .castle = castle ;
75- }
76-
77- public Army getArmy () {
78- return army ;
79- }
80-
81- private void setArmy (final Army army ) {
82- this .army = army ;
83- }
84-
8571 /**
8672 * The factory of kingdom factories.
8773 */
@@ -118,16 +104,16 @@ public static void main(String[] args) {
118104
119105 var app = new App ();
120106
121- LOGGER .info ("Elf Kingdom" );
107+ log .info ("Elf Kingdom" );
122108 app .createKingdom (FactoryMaker .makeFactory (KingdomType .ELF ));
123- LOGGER .info (app .getArmy ().getDescription ());
124- LOGGER .info (app .getCastle ().getDescription ());
125- LOGGER .info (app .getKing ().getDescription ());
109+ log .info (app .getArmy ().getDescription ());
110+ log .info (app .getCastle ().getDescription ());
111+ log .info (app .getKing ().getDescription ());
126112
127- LOGGER .info ("Orc Kingdom" );
113+ log .info ("Orc Kingdom" );
128114 app .createKingdom (FactoryMaker .makeFactory (KingdomType .ORC ));
129- LOGGER .info (app .getArmy ().getDescription ());
130- LOGGER .info (app .getCastle ().getDescription ());
131- LOGGER .info (app .getKing ().getDescription ());
115+ log .info (app .getArmy ().getDescription ());
116+ log .info (app .getCastle ().getDescription ());
117+ log .info (app .getKing ().getDescription ());
132118 }
133119}
0 commit comments