- java.lang.Object
-
- swim.util.Severity
-
- All Implemented Interfaces:
Comparable<Severity>
public final class Severity extends Object implements Comparable<Severity>
Level of importance. Used for log levels and diagnostic classifications.
-
-
Field Summary
Fields Modifier and Type Field Description static int
ALERT_LEVEL
static int
DEBUG_LEVEL
static int
ERROR_LEVEL
static int
FATAL_LEVEL
static int
INFO_LEVEL
static int
NOTE_LEVEL
static int
TRACE_LEVEL
static int
WARNING_LEVEL
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Severity
alert()
Returns theSeverity
withALERT_LEVEL
of importance.static Severity
alert(String label)
Returns aSeverity
withALERT_LEVEL
of importance, and the given descriptivelabel
.int
compareTo(Severity that)
static Severity
create(int level, String label)
Returns aSeverity
with the given importancelevel
, and descriptivelabel
.static Severity
debug()
Returns theSeverity
withDEBUG_LEVEL
of importance.static Severity
debug(String label)
Returns aSeverity
withDEBUG_LEVEL
of importance, and the given descriptivelabel
.boolean
equals(Object other)
static Severity
error()
Returns theSeverity
withERROR_LEVEL
of importance.static Severity
error(String label)
Returns aSeverity
withERROR_LEVEL
of importance, and the given descriptivelabel
.static Severity
fatal()
Returns theSeverity
withFATAL_LEVEL
of importance.static Severity
fatal(String label)
Returns aSeverity
withFATAL_LEVEL
of importance, and the given descriptivelabel
.static Severity
from(int level)
Returns theSeverity
with the given importancelevel
.int
hashCode()
static Severity
info()
Returns theSeverity
withINFO_LEVEL
of importance.static Severity
info(String label)
Returns aSeverity
withINFO_LEVEL
of importance, and the given descriptivelabel
.boolean
isAlert()
Returnstrue
if thisSeverity
hasALERT_LEVEL
of importance.boolean
isDebug()
Returnstrue
if thisSeverity
hasDEBUG_LEVEL
of importance.boolean
isError()
Returnstrue
if thisSeverity
hasERROR_LEVEL
of importance.boolean
isFatal()
Returnstrue
if thisSeverity
hasFATAL_LEVEL
of importance.boolean
isInfo()
Returnstrue
if thisSeverity
hasINFO_LEVEL
of importance.boolean
isNote()
Returnstrue
if thisSeverity
hasNOTE_LEVEL
of importance.boolean
isTrace()
Returnstrue
if thisSeverity
hasTRACE_LEVEL
of importance.boolean
isWarning()
Returnstrue
if thisSeverity
hasWARNING_LEVEL
of importance.String
label()
Returns a descriptive label for thisSeverity
.Severity
label(String label)
Returns a newSeverity
with the same level as thisSeverity
, but with a new descriptivelabel
.int
level()
Returns the integer level of importance of thisSeverity
, with higher levels signifying greater importance.static Severity
note()
Returns theSeverity
withNOTE_LEVEL
of importance.static Severity
note(String label)
Returns aSeverity
withNOTE_LEVEL
of importance, and the given descriptivelabel
.String
toString()
static Severity
trace()
Returns theSeverity
withTRACE_LEVEL
of importance.static Severity
trace(String label)
Returns aSeverity
withTRACE_LEVEL
of importance, and the given descriptivelabel
.static Severity
warning()
Returns theSeverity
withWARNING_LEVEL
of importance.static Severity
warning(String label)
Returns aSeverity
withWARNING_LEVEL
of importance, and the given descriptivelabel
.
-
-
-
Field Detail
-
TRACE_LEVEL
public static final int TRACE_LEVEL
- See Also:
- Constant Field Values
-
DEBUG_LEVEL
public static final int DEBUG_LEVEL
- See Also:
- Constant Field Values
-
INFO_LEVEL
public static final int INFO_LEVEL
- See Also:
- Constant Field Values
-
NOTE_LEVEL
public static final int NOTE_LEVEL
- See Also:
- Constant Field Values
-
WARNING_LEVEL
public static final int WARNING_LEVEL
- See Also:
- Constant Field Values
-
ERROR_LEVEL
public static final int ERROR_LEVEL
- See Also:
- Constant Field Values
-
ALERT_LEVEL
public static final int ALERT_LEVEL
- See Also:
- Constant Field Values
-
FATAL_LEVEL
public static final int FATAL_LEVEL
- See Also:
- Constant Field Values
-
-
Method Detail
-
level
public int level()
Returns the integer level of importance of thisSeverity
, with higher levels signifying greater importance.- Returns:
- an integer between
0
and7
, inclusive. One ofTRACE_LEVEL
,DEBUG_LEVEL
,INFO_LEVEL
,NOTE_LEVEL
,WARNING_LEVEL
,ERROR_LEVEL
,ALERT_LEVEL
, orFATAL_LEVEL
.
-
label
public String label()
Returns a descriptive label for thisSeverity
.
-
label
public Severity label(String label)
Returns a newSeverity
with the same level as thisSeverity
, but with a new descriptivelabel
.
-
isTrace
public boolean isTrace()
Returnstrue
if thisSeverity
hasTRACE_LEVEL
of importance.
-
isDebug
public boolean isDebug()
Returnstrue
if thisSeverity
hasDEBUG_LEVEL
of importance.
-
isInfo
public boolean isInfo()
Returnstrue
if thisSeverity
hasINFO_LEVEL
of importance.
-
isNote
public boolean isNote()
Returnstrue
if thisSeverity
hasNOTE_LEVEL
of importance.
-
isWarning
public boolean isWarning()
Returnstrue
if thisSeverity
hasWARNING_LEVEL
of importance.
-
isError
public boolean isError()
Returnstrue
if thisSeverity
hasERROR_LEVEL
of importance.
-
isAlert
public boolean isAlert()
Returnstrue
if thisSeverity
hasALERT_LEVEL
of importance.
-
isFatal
public boolean isFatal()
Returnstrue
if thisSeverity
hasFATAL_LEVEL
of importance.
-
compareTo
public int compareTo(Severity that)
- Specified by:
compareTo
in interfaceComparable<Severity>
-
create
public static Severity create(int level, String label)
Returns aSeverity
with the given importancelevel
, and descriptivelabel
.- Throws:
IllegalArgumentException
- iflevel
is not a valid level of importance.
-
from
public static Severity from(int level)
Returns theSeverity
with the given importancelevel
.- Throws:
IllegalArgumentException
- iflevel
is not a valid level of importance.
-
trace
public static Severity trace()
Returns theSeverity
withTRACE_LEVEL
of importance.
-
trace
public static Severity trace(String label)
Returns aSeverity
withTRACE_LEVEL
of importance, and the given descriptivelabel
.
-
debug
public static Severity debug()
Returns theSeverity
withDEBUG_LEVEL
of importance.
-
debug
public static Severity debug(String label)
Returns aSeverity
withDEBUG_LEVEL
of importance, and the given descriptivelabel
.
-
info
public static Severity info()
Returns theSeverity
withINFO_LEVEL
of importance.
-
info
public static Severity info(String label)
Returns aSeverity
withINFO_LEVEL
of importance, and the given descriptivelabel
.
-
note
public static Severity note()
Returns theSeverity
withNOTE_LEVEL
of importance.
-
note
public static Severity note(String label)
Returns aSeverity
withNOTE_LEVEL
of importance, and the given descriptivelabel
.
-
warning
public static Severity warning()
Returns theSeverity
withWARNING_LEVEL
of importance.
-
warning
public static Severity warning(String label)
Returns aSeverity
withWARNING_LEVEL
of importance, and the given descriptivelabel
.
-
error
public static Severity error()
Returns theSeverity
withERROR_LEVEL
of importance.
-
error
public static Severity error(String label)
Returns aSeverity
withERROR_LEVEL
of importance, and the given descriptivelabel
.
-
alert
public static Severity alert()
Returns theSeverity
withALERT_LEVEL
of importance.
-
alert
public static Severity alert(String label)
Returns aSeverity
withALERT_LEVEL
of importance, and the given descriptivelabel
.
-
fatal
public static Severity fatal()
Returns theSeverity
withFATAL_LEVEL
of importance.
-
-