#107 Decorator example JavaDoc
This commit is contained in:
parent
3526d96e37
commit
10a911be54
@ -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
|
||||
* "decorate" calls to the target.
|
||||
*
|
||||
* <p>
|
||||
* Using decorator pattern it is possible to change class behavior during
|
||||
* runtime, as the example shows.
|
||||
*
|
||||
*/
|
||||
public class App {
|
||||
|
||||
/**
|
||||
* Program entry point
|
||||
* @param args command line args
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
|
||||
// simple troll
|
||||
|
@ -1,10 +1,10 @@
|
||||
package com.iluwatar.decorator;
|
||||
|
||||
/**
|
||||
* SmartTroll is a decorator for Hostile objects.
|
||||
* The calls to the Hostile interface are intercepted
|
||||
* SmartTroll is a decorator for {@link Hostile} objects.
|
||||
* The calls to the {@link Hostile} interface are intercepted
|
||||
* and decorated. Finally the calls are delegated
|
||||
* to the decorated Hostile object.
|
||||
* to the decorated {@link Hostile} object.
|
||||
*
|
||||
*/
|
||||
public class SmartTroll implements Hostile {
|
||||
|
@ -2,7 +2,7 @@ package com.iluwatar.decorator;
|
||||
|
||||
/**
|
||||
*
|
||||
* Troll implements Hostile interface directly.
|
||||
* Troll implements {@link Hostile} interface directly.
|
||||
*
|
||||
*/
|
||||
public class Troll implements Hostile {
|
||||
|
@ -4,6 +4,11 @@ import org.junit.Test;
|
||||
|
||||
import com.iluwatar.decorator.App;
|
||||
|
||||
/**
|
||||
*
|
||||
* Application test
|
||||
*
|
||||
*/
|
||||
public class AppTest {
|
||||
|
||||
@Test
|
||||
|
Loading…
x
Reference in New Issue
Block a user