Class Severity

  • All Implemented Interfaces:
    Serializable

    @Immutable
    public class Severity
    extends Object
    implements Serializable
    Severity of an issue. The predefined set of severities consists of an error and 3 warnings with priorities high, normal, or low. Additional severities can be created if this set of severities is not sufficient. Note that new instances are not cached by this class so that there might exist several severity instances with the same name.
    Author:
    Ullrich Hafner
    See Also:
    Serialized Form
    • Field Detail

      • ERROR

        public static final Severity ERROR
        An error, e.g. a compile error.
      • WARNING_HIGH

        public static final Severity WARNING_HIGH
        A warning with priority high. Mapping of warning priorities is determined by the corresponding tool.
      • WARNING_NORMAL

        public static final Severity WARNING_NORMAL
        A warning with priority normal. Mapping of warning priorities is determined by the corresponding tool.
      • WARNING_LOW

        public static final Severity WARNING_LOW
        A warning with priority low. Mapping of warning priorities is determined by the corresponding tool.
    • Constructor Detail

      • Severity

        public Severity​(String name)
        Creates a new Severity with the specified name.
        Parameters:
        name - the name of the severity
    • Method Detail

      • valueOf

        public static Severity valueOf​(String name)
        Creates a new Severity with the specified name. If the name is the same as the name of one of the predefined severities, then this existing severity is returned.
        Parameters:
        name - the name of the severity
        Returns:
        the severity
      • valueOf

        public static Severity valueOf​(@CheckForNull
                                       String severity,
                                       Severity defaultValue)
        Converts a String severity to one of the predefined severities. If the provided String does not match then the default severity will be returned.
        Parameters:
        severity - priority as a String
        defaultValue - default severity, if the specified String is null or is not a valid Severity name
        Returns:
        enumeration value
      • guessFromString

        public static Severity guessFromString​(@CheckForNull
                                               String severity)
        Converts a String severity to one of the predefined severities. If the provided String does not match (even partly) then the default severity will be returned.
        Parameters:
        severity - the severity string
        Returns:
        mapped level.
      • collectSeveritiesFrom

        public static Collection<Severity> collectSeveritiesFrom​(Severity minimumSeverity)
        Gets the severities starting from the specified severity to ERROR.
        Parameters:
        minimumSeverity - the minimum priority
        Returns:
        the priorities starting from the specified priority
      • getPredefinedValues

        public static Set<Severity> getPredefinedValues()
        Returns the set of predefined Severity instances.
        Returns:
        all predefined severities
      • getName

        public String getName()
        Returns the name of the severity.
        Returns:
        the name of the severity
      • equalsIgnoreCase

        public boolean equalsIgnoreCase​(String severityName)
        Checks if this instance has a name that is equal to the specified name.
        Parameters:
        severityName - the name to check
        Returns:
        true if this instance has the same name, false otherwise
      • equals

        public boolean equals​(@CheckForNull
                              Object o)
        Overrides:
        equals in class Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object