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 {
13 this.description = description;
14 this.type = type;
15 }
16
17 public static EventType get(String type)
18 {
19 return Johnson.getConfig().getEventType(type);
20 }
21
22 public boolean equals(Object o)
23 {
24 if (this == o)
25 {
26 return true;
27 }
28 if (!(o instanceof EventType))
29 {
30 return false;
31 }
32
33 EventType e = (EventType) o;
34 return ObjectUtils.equals(getDescription(), e.getDescription()) &&
35 ObjectUtils.equals(getType(), e.getType());
36 }
37
38 public String getDescription()
39 {
40 return description;
41 }
42
43 public String getType()
44 {
45 return type;
46 }
47
48 public int hashCode()
49 {
50 int result = 29;
51 result = 31 * result + ObjectUtils.hashCode(getType());
52 result = 31 * result + ObjectUtils.hashCode(getDescription());
53 return result;
54 }
55
56 public String toString()
57 {
58 return "(EventType: " + type + ")";
59 }
60 }