1 package com.atlassian.johnson.event;
2
3 import com.atlassian.johnson.config.JohnsonConfig;
4
5 public final class EventLevel
6 {
7 public static final String WARNING = "warning";
8 public static final String ERROR = "error";
9 public static final String FATAL = "fatal";
10
11 private String level;
12 private String description;
13
14 public EventLevel(String level, String description)
15 {
16 this.level = level;
17 this.description = description;
18 }
19
20 public static EventLevel get(String level)
21 {
22 return JohnsonConfig.getInstance().getEventLevel(level);
23 }
24
25 public String getLevel()
26 {
27 return level;
28 }
29
30 public String getDescription()
31 {
32 return description;
33 }
34
35 public String toString()
36 {
37 return "(EventLevel: " + level + ")";
38 }
39
40 public boolean equals(Object o)
41 {
42 if (this == o) return true;
43 if (!(o instanceof EventLevel)) return false;
44
45 final EventLevel eventLevel = (EventLevel) o;
46
47 if (description != null ? !description.equals(eventLevel.description) : eventLevel.description != null) return false;
48 if (!level.equals(eventLevel.level)) return false;
49
50 return true;
51 }
52
53 public int hashCode()
54 {
55 int result;
56 result = level.hashCode();
57 result = 29 * result + (description != null ? description.hashCode() : 0);
58 return result;
59 }
60 }