- 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 intALERT_LEVELstatic intDEBUG_LEVELstatic intERROR_LEVELstatic intFATAL_LEVELstatic intINFO_LEVELstatic intNOTE_LEVELstatic intTRACE_LEVELstatic intWARNING_LEVEL
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Severityalert()Returns theSeveritywithALERT_LEVELof importance.static Severityalert(String label)Returns aSeveritywithALERT_LEVELof importance, and the given descriptivelabel.intcompareTo(Severity that)static Severitycreate(int level, String label)Returns aSeveritywith the given importancelevel, and descriptivelabel.static Severitydebug()Returns theSeveritywithDEBUG_LEVELof importance.static Severitydebug(String label)Returns aSeveritywithDEBUG_LEVELof importance, and the given descriptivelabel.booleanequals(Object other)static Severityerror()Returns theSeveritywithERROR_LEVELof importance.static Severityerror(String label)Returns aSeveritywithERROR_LEVELof importance, and the given descriptivelabel.static Severityfatal()Returns theSeveritywithFATAL_LEVELof importance.static Severityfatal(String label)Returns aSeveritywithFATAL_LEVELof importance, and the given descriptivelabel.static Severityfrom(int level)Returns theSeveritywith the given importancelevel.inthashCode()static Severityinfo()Returns theSeveritywithINFO_LEVELof importance.static Severityinfo(String label)Returns aSeveritywithINFO_LEVELof importance, and the given descriptivelabel.booleanisAlert()Returnstrueif thisSeverityhasALERT_LEVELof importance.booleanisDebug()Returnstrueif thisSeverityhasDEBUG_LEVELof importance.booleanisError()Returnstrueif thisSeverityhasERROR_LEVELof importance.booleanisFatal()Returnstrueif thisSeverityhasFATAL_LEVELof importance.booleanisInfo()Returnstrueif thisSeverityhasINFO_LEVELof importance.booleanisNote()Returnstrueif thisSeverityhasNOTE_LEVELof importance.booleanisTrace()Returnstrueif thisSeverityhasTRACE_LEVELof importance.booleanisWarning()Returnstrueif thisSeverityhasWARNING_LEVELof importance.Stringlabel()Returns a descriptive label for thisSeverity.Severitylabel(String label)Returns a newSeveritywith the same level as thisSeverity, but with a new descriptivelabel.intlevel()Returns the integer level of importance of thisSeverity, with higher levels signifying greater importance.static Severitynote()Returns theSeveritywithNOTE_LEVELof importance.static Severitynote(String label)Returns aSeveritywithNOTE_LEVELof importance, and the given descriptivelabel.StringtoString()static Severitytrace()Returns theSeveritywithTRACE_LEVELof importance.static Severitytrace(String label)Returns aSeveritywithTRACE_LEVELof importance, and the given descriptivelabel.static Severitywarning()Returns theSeveritywithWARNING_LEVELof importance.static Severitywarning(String label)Returns aSeveritywithWARNING_LEVELof 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
0and7, 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 newSeveritywith the same level as thisSeverity, but with a new descriptivelabel.
-
isTrace
public boolean isTrace()
Returnstrueif thisSeverityhasTRACE_LEVELof importance.
-
isDebug
public boolean isDebug()
Returnstrueif thisSeverityhasDEBUG_LEVELof importance.
-
isInfo
public boolean isInfo()
Returnstrueif thisSeverityhasINFO_LEVELof importance.
-
isNote
public boolean isNote()
Returnstrueif thisSeverityhasNOTE_LEVELof importance.
-
isWarning
public boolean isWarning()
Returnstrueif thisSeverityhasWARNING_LEVELof importance.
-
isError
public boolean isError()
Returnstrueif thisSeverityhasERROR_LEVELof importance.
-
isAlert
public boolean isAlert()
Returnstrueif thisSeverityhasALERT_LEVELof importance.
-
isFatal
public boolean isFatal()
Returnstrueif thisSeverityhasFATAL_LEVELof importance.
-
compareTo
public int compareTo(Severity that)
- Specified by:
compareToin interfaceComparable<Severity>
-
create
public static Severity create(int level, String label)
Returns aSeveritywith the given importancelevel, and descriptivelabel.- Throws:
IllegalArgumentException- iflevelis not a valid level of importance.
-
from
public static Severity from(int level)
Returns theSeveritywith the given importancelevel.- Throws:
IllegalArgumentException- iflevelis not a valid level of importance.
-
trace
public static Severity trace()
Returns theSeveritywithTRACE_LEVELof importance.
-
trace
public static Severity trace(String label)
Returns aSeveritywithTRACE_LEVELof importance, and the given descriptivelabel.
-
debug
public static Severity debug()
Returns theSeveritywithDEBUG_LEVELof importance.
-
debug
public static Severity debug(String label)
Returns aSeveritywithDEBUG_LEVELof importance, and the given descriptivelabel.
-
info
public static Severity info()
Returns theSeveritywithINFO_LEVELof importance.
-
info
public static Severity info(String label)
Returns aSeveritywithINFO_LEVELof importance, and the given descriptivelabel.
-
note
public static Severity note()
Returns theSeveritywithNOTE_LEVELof importance.
-
note
public static Severity note(String label)
Returns aSeveritywithNOTE_LEVELof importance, and the given descriptivelabel.
-
warning
public static Severity warning()
Returns theSeveritywithWARNING_LEVELof importance.
-
warning
public static Severity warning(String label)
Returns aSeveritywithWARNING_LEVELof importance, and the given descriptivelabel.
-
error
public static Severity error()
Returns theSeveritywithERROR_LEVELof importance.
-
error
public static Severity error(String label)
Returns aSeveritywithERROR_LEVELof importance, and the given descriptivelabel.
-
alert
public static Severity alert()
Returns theSeveritywithALERT_LEVELof importance.
-
alert
public static Severity alert(String label)
Returns aSeveritywithALERT_LEVELof importance, and the given descriptivelabel.
-
fatal
public static Severity fatal()
Returns theSeveritywithFATAL_LEVELof importance.
-
-