KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > oddjob > logging > LogLevel


1 package org.oddjob.logging;
2
3 import java.io.ObjectStreamException JavaDoc;
4 import java.io.Serializable JavaDoc;
5
6
7 /**
8  * @author Rob Gordon
9  */

10
11 public class LogLevel implements Serializable JavaDoc {
12
13     /**
14      */

15     public final static LogLevel DEBUG = new LogLevel(1);
16     public final static LogLevel INFO = new LogLevel(2);
17     public final static LogLevel WARN = new LogLevel(3);
18     public final static LogLevel ERROR = new LogLevel(4);
19     public final static LogLevel FATAL = new LogLevel(5);
20
21     private final int level;
22
23     private static int nextOrdinal = 0;
24     
25     private final int ordinal = nextOrdinal++;
26
27     private static final LogLevel[] allValues = {
28         DEBUG, INFO,
29         WARN, ERROR,
30         FATAL};
31     
32     /**
33      * Private Constructor.
34      *
35      */

36     private LogLevel(int level) {
37         this.level = level;
38     }
39         
40     private Object JavaDoc readResolve() throws ObjectStreamException JavaDoc {
41         return allValues[ordinal];
42     }
43     
44     public boolean isLessThan(LogLevel other) {
45         return this.level < other.level;
46     }
47 }
48
49
Popular Tags