|
2 | 2 |
|
3 | 3 | import com.iluwatar.delegation.simple.printers.CanonPrinter; |
4 | 4 | import com.iluwatar.delegation.simple.printers.EpsonPrinter; |
5 | | -import com.iluwatar.delegation.simple.printers.HPPrinter; |
| 5 | +import com.iluwatar.delegation.simple.printers.HpPrinter; |
6 | 6 |
|
7 | 7 | /** |
8 | | - * In this example the delegates are {@link EpsonPrinter}, {@link HPPrinter} and {@link CanonPrinter} they all implement |
9 | | - * {@link Printer}. The {@link AbstractPrinterController} and through inheritance {@link PrinterController} also implement |
10 | | - * {@link Printer}. However neither provide the functionality of {@link Printer} by printing to the screen, they actually |
11 | | - * call upon the instance of {@link Printer} that they were instantiated with. Therefore delegating the behaviour to |
12 | | - * another class. |
| 8 | + * In this example the delegates are {@link EpsonPrinter}, {@link HpPrinter} and {@link CanonPrinter} they all implement |
| 9 | + * {@link Printer}. The {@link AbstractPrinterController} and through inheritance {@link PrinterController} also |
| 10 | + * implement {@link Printer}. However neither provide the functionality of {@link Printer} by printing to the screen, |
| 11 | + * they actually call upon the instance of {@link Printer} that they were instantiated with. Therefore delegating the |
| 12 | + * behaviour to another class. |
13 | 13 | */ |
14 | 14 | public class App { |
15 | 15 |
|
16 | | - public static final String MESSAGE_TO_PRINT = "hello world"; |
| 16 | + public static final String MESSAGE_TO_PRINT = "hello world"; |
17 | 17 |
|
18 | | - /** |
19 | | - * Program entry point |
20 | | - * |
21 | | - * @param args command line args |
22 | | - */ |
23 | | - public static void main(String[] args) { |
24 | | - AbstractPrinterController hpPrinterController = new PrinterController(new HPPrinter()); |
25 | | - AbstractPrinterController canonPrinterController = new PrinterController(new CanonPrinter()); |
26 | | - AbstractPrinterController epsonPrinterController = new PrinterController(new EpsonPrinter()); |
| 18 | + /** |
| 19 | + * Program entry point |
| 20 | + * |
| 21 | + * @param args command line args |
| 22 | + */ |
| 23 | + public static void main(String[] args) { |
| 24 | + AbstractPrinterController hpPrinterController = new PrinterController(new HpPrinter()); |
| 25 | + AbstractPrinterController canonPrinterController = new PrinterController(new CanonPrinter()); |
| 26 | + AbstractPrinterController epsonPrinterController = new PrinterController(new EpsonPrinter()); |
27 | 27 |
|
28 | | - hpPrinterController.print(MESSAGE_TO_PRINT); |
29 | | - canonPrinterController.print(MESSAGE_TO_PRINT); |
30 | | - epsonPrinterController.print(MESSAGE_TO_PRINT); |
31 | | - } |
| 28 | + hpPrinterController.print(MESSAGE_TO_PRINT); |
| 29 | + canonPrinterController.print(MESSAGE_TO_PRINT); |
| 30 | + epsonPrinterController.print(MESSAGE_TO_PRINT); |
| 31 | + } |
32 | 32 |
|
33 | 33 | } |
0 commit comments