-
Notifications
You must be signed in to change notification settings - Fork 0
/
ConversationCommand.java
36 lines (28 loc) · 1.15 KB
/
ConversationCommand.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package demo.reaktive.conversation;
import java.io.Serializable;
/** Base class for commands that can be sent to the actor */
public abstract class ConversationCommand implements Serializable {
private static final long serialVersionUID = 1L;
public static final class GetMessageList extends ConversationCommand {
private static final long serialVersionUID = 1L;
private GetMessageList() {}
}
public static final class PostMessage extends ConversationCommand {
private static final long serialVersionUID = 1L;
private final String message;
private PostMessage(String message) {
this.message = message;
}
public String getMessage() {
return message;
}
}
/** Command that can be sent to the actor to retrieve the full message list */
public static GetMessageList getMessageList() {
return new GetMessageList();
}
/** Command that can be sent to the actor to request posting a new entry to the conversation */
public static PostMessage postMessage(String message) {
return new PostMessage(message);
}
}