Update App.java to have more information on the pattern #324

This commit is contained in:
Joseph McCarthy 2015-12-30 20:07:42 +00:00
parent dec5ff22fc
commit 623c2081cd

View File

@ -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 {