ae5a5019cd8e4a3fc2f2a2d0721156260717d355
[demos/kafka/chat] /
1 package de.juplo.kafka.chat.backend.implementation.kafka.messages.info;
2
3 import de.juplo.kafka.chat.backend.domain.ChatRoomInfo;
4 import de.juplo.kafka.chat.backend.implementation.kafka.messages.AbstractMessageTo;
5 import lombok.EqualsAndHashCode;
6 import lombok.Getter;
7 import lombok.Setter;
8 import lombok.ToString;
9
10 import java.util.UUID;
11
12
13 @Getter
14 @Setter
15 @EqualsAndHashCode
16 @ToString
17 public class EventChatRoomCreated extends AbstractMessageTo
18 {
19   private String id;
20   private String name;
21   private Integer shard;
22
23
24   public EventChatRoomCreated()
25   {
26     super(ToType.EVENT_CHATROOM_CREATED);
27   }
28
29
30   public ChatRoomInfo toChatRoomInfo()
31   {
32     return new ChatRoomInfo(UUID.fromString(id), name, shard);
33   }
34
35   public static EventChatRoomCreated of(UUID id, String name, Integer shard)
36   {
37     EventChatRoomCreated event = new EventChatRoomCreated();
38
39     event.setId(id.toString());
40     event.setName(name);
41     event.setShard(shard);
42
43     return event;
44   }
45 }