1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package nl.hippo.client.api.event;
17
18 import nl.hippo.client.api.caching.SourceValidity;
19
20 public class EventValidityImpl implements EventValidity {
21
22 private static final long serialVersionUID = 1L;
23 private NamedEvent m_event;
24
25 public EventValidityImpl(String name) {
26 m_event = new NamedEvent(name);
27 }
28
29 /**
30 * Returns the specific NamedEvent this validity is based on.
31 *
32 * @return Event
33 */
34 public NamedEvent getEvent() {
35 return m_event;
36 }
37
38 public boolean equals(Object o) {
39 if (o instanceof EventValidity) {
40 return m_event.equals(((EventValidity) o).getEvent());
41 }
42 return false;
43 }
44
45 public int hashCode() {
46 return m_event.hashCode();
47 }
48
49 public String toString() {
50 return "EventValidity[" + m_event + "]";
51 }
52
53 public int isValid() {
54 return VALID;
55 }
56
57 public int isValid(SourceValidity newValidity) {
58 if (newValidity instanceof EventValidity) {
59 return VALID;
60 }
61 return INVALID;
62 }
63 }