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:
  • 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.