Skip to content

Commit 10d4e3c

Browse files
committed
Improved comments for decorator example.
1 parent 9a75cb1 commit 10d4e3c

File tree

3 files changed

+17
-0
lines changed

3 files changed

+17
-0
lines changed

decorator/src/main/java/com/iluwatar/Hostile.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
package com.iluwatar;
22

3+
/**
4+
*
5+
* Interface for the hostile enemies.
6+
*
7+
*/
38
public interface Hostile {
49

510
void attack();

decorator/src/main/java/com/iluwatar/SmartTroll.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
package com.iluwatar;
22

3+
/**
4+
* SmartTroll is a decorator for Hostile objects.
5+
* The calls to the Hostile interface are intercepted
6+
* and decorated. Finally the calls are delegated
7+
* to the decorated Hostile object.
8+
*
9+
*/
310
public class SmartTroll implements Hostile {
411

512
private Hostile decorated;

decorator/src/main/java/com/iluwatar/Troll.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
package com.iluwatar;
22

3+
/**
4+
*
5+
* Troll implements Hostile interface directly.
6+
*
7+
*/
38
public class Troll implements Hostile {
49

510
public void attack() {

0 commit comments

Comments
 (0)