1 package org.oddjob.logging; 2 3 import java.io.ObjectStreamException ; 4 import java.io.Serializable ; 5 6 7 10 11 public class LogLevel implements Serializable { 12 13 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 36 private LogLevel(int level) { 37 this.level = level; 38 } 39 40 private Object readResolve() throws ObjectStreamException { 41 return allValues[ordinal]; 42 } 43 44 public boolean isLessThan(LogLevel other) { 45 return this.level < other.level; 46 } 47 } 48 49 | Popular Tags |