Update App.java to have more information on the pattern #324
This commit is contained in:
parent
dec5ff22fc
commit
623c2081cd
@ -5,11 +5,16 @@ import com.iluwatar.delegation.simple.printers.EpsonPrinter;
|
|||||||
import com.iluwatar.delegation.simple.printers.HpPrinter;
|
import com.iluwatar.delegation.simple.printers.HpPrinter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* The delegate pattern provides a mechanism to abstract away the implementation and control of the desired action.
|
||||||
|
* The class being called in this case {@link PrinterController} is not responsible for the actual desired action,
|
||||||
|
* but is actually delegated to a helper class either {@link CanonPrinter}, {@link EpsonPrinter} or {@link HpPrinter}.
|
||||||
|
* The consumer does not have or require knowledge of the actual class carrying out the action, only the
|
||||||
|
* container on which they are calling.
|
||||||
|
*
|
||||||
* In this example the delegates are {@link EpsonPrinter}, {@link HpPrinter} and {@link CanonPrinter} they all implement
|
* In this example the delegates are {@link EpsonPrinter}, {@link HpPrinter} and {@link CanonPrinter} they all implement
|
||||||
* {@link Printer}. The {@link AbstractPrinterController} and through inheritance {@link PrinterController} also
|
* {@link Printer}. The {@link PrinterController} class also implements {@link Printer}. However neither provide the
|
||||||
* implement {@link Printer}. However neither provide the functionality of {@link Printer} by printing to the screen,
|
* functionality of {@link Printer} by printing to the screen, they actually call upon the instance of {@link Printer}
|
||||||
* they actually call upon the instance of {@link Printer} that they were instantiated with. Therefore delegating the
|
* that they were instantiated with. Therefore delegating the behaviour to another class.
|
||||||
* behaviour to another class.
|
|
||||||
*/
|
*/
|
||||||
public class App {
|
public class App {
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user