MCPcopy Create free account
hub / github.com/InterviewReady/Low-Level-Design / Event

Class Event

distributed-cache/src/main/java/events/Event.java:7–37  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5import java.util.UUID;
6
7public abstract class Event<KEY, VALUE> {
8 private final String id;
9 private final Record<KEY, VALUE> element;
10 private final long timestamp;
11
12 public Event(Record<KEY, VALUE> element, long timestamp) {
13 this.element = element;
14 this.timestamp = timestamp;
15 id = UUID.randomUUID().toString();
16 }
17
18 public String getId() {
19 return id;
20 }
21
22 public Record<KEY, VALUE> getElement() {
23 return element;
24 }
25
26 public long getTimestamp() {
27 return timestamp;
28 }
29
30 @Override
31 public String toString() {
32 return this.getClass().getName() + "{" +
33 "element=" + element +
34 ", timestamp=" + timestamp +
35 "}\n";
36 }
37}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected