#107 Decorator example JavaDoc

This commit is contained in:
Ilkka Seppala 2015-08-18 22:10:57 +03:00
parent 3526d96e37
commit 10a911be54
4 changed files with 100 additions and 91 deletions

View File

@ -2,16 +2,20 @@ package com.iluwatar.decorator;
/** /**
* *
* Decorator pattern is more flexible alternative to subclassing. The decorator * Decorator pattern is a more flexible alternative to subclassing. The decorator
* class implements the same interface as the target and uses composition to * class implements the same interface as the target and uses composition to
* "decorate" calls to the target. * "decorate" calls to the target.
* * <p>
* Using decorator pattern it is possible to change class behavior during * Using decorator pattern it is possible to change class behavior during
* runtime, as the example shows. * runtime, as the example shows.
* *
*/ */
public class App { public class App {
/**
* Program entry point
* @param args command line args
*/
public static void main(String[] args) { public static void main(String[] args) {
// simple troll // simple troll

View File

@ -1,10 +1,10 @@
package com.iluwatar.decorator; package com.iluwatar.decorator;
/** /**
* SmartTroll is a decorator for Hostile objects. * SmartTroll is a decorator for {@link Hostile} objects.
* The calls to the Hostile interface are intercepted * The calls to the {@link Hostile} interface are intercepted
* and decorated. Finally the calls are delegated * and decorated. Finally the calls are delegated
* to the decorated Hostile object. * to the decorated {@link Hostile} object.
* *
*/ */
public class SmartTroll implements Hostile { public class SmartTroll implements Hostile {

View File

@ -2,7 +2,7 @@ package com.iluwatar.decorator;
/** /**
* *
* Troll implements Hostile interface directly. * Troll implements {@link Hostile} interface directly.
* *
*/ */
public class Troll implements Hostile { public class Troll implements Hostile {

View File

@ -4,6 +4,11 @@ import org.junit.Test;
import com.iluwatar.decorator.App; import com.iluwatar.decorator.App;
/**
*
* Application test
*
*/
public class AppTest { public class AppTest {
@Test @Test