View Javadoc

1   /**
2    * Atlassian Source Code Template.
3    * User: Bobby
4    * Date: Apr 8, 2003
5    * Time: 9:56:50 AM
6    * CVS Revision: $Revision: 1.2 $
7    * Last CVS Commit: $Date: 2003/12/13 06:09:33 $
8    * Author of last CVS Commit: $Author: mcannon $
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  }