1 package com.atlassian.johnson.event;
2
3 import com.atlassian.johnson.Johnson;
4 import org.apache.commons.lang.ObjectUtils;
5
6 public class EventType {
7
8 private final String description;
9 private final String type;
10
11 public EventType(String type, String description) {
12 this.description = description;
13 this.type = type;
14 }
15
16 public static EventType get(String type) {
17 return Johnson.getConfig().getEventType(type);
18 }
19
20 public boolean equals(Object o) {
21 if (this == o) {
22 return true;
23 }
24 if (!(o instanceof EventType)) {
25 return false;
26 }
27
28 EventType e = (EventType) o;
29 return ObjectUtils.equals(getDescription(), e.getDescription()) &&
30 ObjectUtils.equals(getType(), e.getType());
31 }
32
33 public String getDescription() {
34 return description;
35 }
36
37 public String getType() {
38 return type;
39 }
40
41 public int hashCode() {
42 int result = 29;
43 result = 31 * result + ObjectUtils.hashCode(getType());
44 result = 31 * result + ObjectUtils.hashCode(getDescription());
45 return result;
46 }
47
48 public String toString() {
49 return "(EventType: " + type + ")";
50 }
51 }