Improved comments for decorator example.

This commit is contained in:
Ilkka Seppala 2014-12-06 14:29:31 +02:00
parent 9a75cb11c3
commit 10d4e3cadd
3 changed files with 17 additions and 0 deletions

View File

@ -1,5 +1,10 @@
package com.iluwatar;
/**
*
* Interface for the hostile enemies.
*
*/
public interface Hostile {
void attack();

View File

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

View File

@ -1,5 +1,10 @@
package com.iluwatar;
/**
*
* Troll implements Hostile interface directly.
*
*/
public class Troll implements Hostile {
public void attack() {