View Javadoc

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