Skip to content

Commit 5b81a88

Browse files
committed
[refactor] Update Action enum in mediator pattern.
1 parent c23f58e commit 5b81a88

File tree

1 file changed

+8
-13
lines changed

1 file changed

+8
-13
lines changed

mediator/src/main/java/com/iluwatar/Action.java

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,15 @@
77
*/
88
public enum Action {
99

10-
HUNT, TALE, GOLD, ENEMY;
10+
HUNT("hunted a rabbit"), TALE("tells a tale"), GOLD("found gold"), ENEMY("spotted enemies"), NONE("");
1111

12-
public String toString() {
12+
private String title;
1313

14-
switch (this) {
15-
case ENEMY:
16-
return "spotted enemies";
17-
case GOLD:
18-
return "found gold";
19-
case HUNT:
20-
return "hunted a rabbit";
21-
case TALE:
22-
return "tells a tale";
23-
}
24-
return "";
14+
Action(String title) {
15+
this.title = title;
16+
}
17+
18+
public String toString() {
19+
return title;
2520
}
2621
}

0 commit comments

Comments
 (0)