File tree Expand file tree Collapse file tree 3 files changed +17
-0
lines changed
decorator/src/main/java/com/iluwatar Expand file tree Collapse file tree 3 files changed +17
-0
lines changed Original file line number Diff line number Diff line change 11package com .iluwatar ;
22
3+ /**
4+ *
5+ * Interface for the hostile enemies.
6+ *
7+ */
38public interface Hostile {
49
510 void attack ();
Original file line number Diff line number Diff line change 11package 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+ */
310public class SmartTroll implements Hostile {
411
512 private Hostile decorated ;
Original file line number Diff line number Diff line change 11package com .iluwatar ;
22
3+ /**
4+ *
5+ * Troll implements Hostile interface directly.
6+ *
7+ */
38public class Troll implements Hostile {
49
510 public void attack () {
You can’t perform that action at this time.
0 commit comments