Skip to content

Commit

Permalink
Improved comments for decorator example.
Browse files Browse the repository at this point in the history
  • Loading branch information
iluwatar committed Dec 6, 2014
1 parent 9a75cb1 commit 10d4e3c
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
5 changes: 5 additions & 0 deletions decorator/src/main/java/com/iluwatar/Hostile.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
package com.iluwatar;

/**
*
* Interface for the hostile enemies.
*
*/
public interface Hostile {

void attack();
Expand Down
7 changes: 7 additions & 0 deletions decorator/src/main/java/com/iluwatar/SmartTroll.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
package com.iluwatar;

/**
* SmartTroll is a decorator for Hostile objects.
* The calls to the Hostile interface are intercepted
* and decorated. Finally the calls are delegated
* to the decorated Hostile object.
*
*/
public class SmartTroll implements Hostile {

private Hostile decorated;
Expand Down
5 changes: 5 additions & 0 deletions decorator/src/main/java/com/iluwatar/Troll.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
package com.iluwatar;

/**
*
* Troll implements Hostile interface directly.
*
*/
public class Troll implements Hostile {

public void attack() {
Expand Down

0 comments on commit 10d4e3c

Please sign in to comment.