Package com.onwbp.base.text

# Class Severity

java.lang.Object
com.onwbp.base.text.Severity

public final class Severity extends Object
This enumeration class defines the possible severity levels of user messages.

See Also:
  - `UserMessage`

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final Severity`
  `ERROR`
  Specifies an error.
  `static final Severity`
  `FATAL`
  Specifies a "fatal" error, the highest severity.
  `static final Severity`
  `INFO`
  Specifies an information message, the lowest severity.
  `static final Severity`
  `WARNING`
  Specifies a warning.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static Map<Severity,UserMessage>`
  `getAllSeveritiesWithLabel()`
  Returns a map from the available severities to their corresponding user message.
  `String`
  `getLabel()`
  `boolean`
  `isEqualOrMoreSevereThan(Severity anotherSeverity)`
  Returns `true` if this severity level is equal to or higher than the one specified.
  `boolean`
  `isError()`
  `boolean`
  `isFatal()`
  `boolean`
  `isInfo()`
  `boolean`
  `isWarning()`
  `static Severity`
  `parseFlag(String aFlag)`
  Returns the severity instance corresponding to the flag specified.
  `static Severity`
  `parseLabel(String aLabel)`
  Returns the severity instance that corresponds with the label specified.
  `String`
  `toParsableString()`
  Returns a flag identifying the severity.
  `String`
  `toString()`

  ### Methods inherited from class java.lang.Object

  `equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- ## Field Details

  - ### FATAL

    public static final Severity FATAL
    Specifies a "fatal" error, the highest severity.

  - ### ERROR

    public static final Severity ERROR
    Specifies an error.

  - ### WARNING

    public static final Severity WARNING
    Specifies a warning.

  - ### INFO

    public static final Severity INFO
    Specifies an information message, the lowest severity.

- ## Method Details

  - ### parseFlag

    public static Severity parseFlag(String aFlag) throws IllegalArgumentException
    Returns the severity instance corresponding to the flag specified. The flag should have been generated by method `toParsableString()`.
    Throws:
      `IllegalArgumentException` - if aFlag does not have the format expected, or if it is not recognized.

  - ### parseLabel

    public static Severity parseLabel(String aLabel) throws IllegalArgumentException
    Returns the severity instance that corresponds with the label specified. The label should have been generated by method `getLabel()`.
    Throws:
      `IllegalArgumentException` - if aLabel is not recognized.

  - ### getLabel

    public String getLabel()

  - ### toParsableString

    public String toParsableString()
    Returns a flag identifying the severity. The returned string can be converted back into a `Severity` instance using method `parseFlag(String)`.

  - ### toString

    public String toString()
    Overrides:
      `toString` in class `Object`

  - ### isFatal

    public boolean isFatal()

  - ### isError

    public boolean isError()

  - ### isWarning

    public boolean isWarning()

  - ### isInfo

    public boolean isInfo()

  - ### isEqualOrMoreSevereThan

    public boolean isEqualOrMoreSevereThan(Severity anotherSeverity)
    Returns `true` if this severity level is equal to or higher than the one specified.

    The order of severity levels is as follows:

    > `FATAL > ERROR > WARNING > INFO`

  - ### getAllSeveritiesWithLabel

    public static Map<Severity,UserMessage> getAllSeveritiesWithLabel()
    Returns a map from the available severities to their corresponding user message.