From 623c2081cd1213909ae98f65f8826140740b4485 Mon Sep 17 00:00:00 2001 From: Joseph McCarthy Date: Wed, 30 Dec 2015 20:07:42 +0000 Subject: [PATCH] Update App.java to have more information on the pattern #324 --- .../java/com/iluwatar/delegation/simple/App.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/delegation/src/main/java/com/iluwatar/delegation/simple/App.java b/delegation/src/main/java/com/iluwatar/delegation/simple/App.java index e0c1ad44d..050380c18 100644 --- a/delegation/src/main/java/com/iluwatar/delegation/simple/App.java +++ b/delegation/src/main/java/com/iluwatar/delegation/simple/App.java @@ -5,11 +5,16 @@ import com.iluwatar.delegation.simple.printers.EpsonPrinter; 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 - * {@link Printer}. The {@link AbstractPrinterController} and through inheritance {@link PrinterController} also - * implement {@link Printer}. However neither provide the functionality of {@link Printer} by printing to the screen, - * they actually call upon the instance of {@link Printer} that they were instantiated with. Therefore delegating the - * behaviour to another class. + * {@link Printer}. The {@link PrinterController} class also implements {@link Printer}. However neither provide the + * functionality of {@link Printer} by printing to the screen, they actually call upon the instance of {@link Printer} + * that they were instantiated with. Therefore delegating the behaviour to another class. */ public class App {