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