File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed
decorator/src/main/java/com/iluwatar/decorator Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change 22
33/**
44 *
5- * Decorator pattern is a more flexible alternative to subclassing. The decorator
5+ * The Decorator pattern is a more flexible alternative to subclassing. The Decorator
66 * class implements the same interface as the target and uses composition to
7- * "decorate" calls to the target.
7+ * "decorate" calls to the target. Using the Decorator pattern it is possible to
8+ * change the behavior of the class during runtime.
89 * <p>
9- * Using decorator pattern it is possible to change class behavior during
10- * runtime, as the example shows.
10+ * In this example we show how the simple {@link Troll} first attacks and then
11+ * flees the battle. Then we decorate the {@link Troll} with a {@link SmartTroll}
12+ * and perform the attack again. You can see how the behavior changes after the
13+ * decoration.
1114 *
1215 */
1316public class App {
You can’t perform that action at this time.
0 commit comments