Package edu.hm.hafner.analysis
Class Severity
- java.lang.Object
-
- edu.hm.hafner.analysis.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 Summary
Fields Modifier and Type Field Description static SeverityERRORAn error, e.g. a compile error.static SeverityWARNING_HIGHA warning with priority high.static SeverityWARNING_LOWA warning with priority low.static SeverityWARNING_NORMALA warning with priority normal.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Collection<Severity>collectSeveritiesFrom(Severity minimumSeverity)Gets the severities starting from the specified severity toERROR.booleanequals(Object o)booleanequalsIgnoreCase(String severityName)Checks if this instance has a name that is equal to the specified name.StringgetName()Returns the name of the severity.static Set<Severity>getPredefinedValues()Returns the set of predefinedSeverityinstances.static SeverityguessFromString(String severity)Converts a String severity to one of the predefined severities.inthashCode()StringtoString()static SeverityvalueOf(String name)Creates a newSeveritywith the specified name.static SeverityvalueOf(String severity, Severity defaultValue)Converts a String severity to one of the predefined severities.
-
-
-
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.
-
-
Method Detail
-
valueOf
public static Severity valueOf(String name)
Creates a newSeveritywith 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 StringdefaultValue- default severity, if the specified String isnullor is not a validSeverityname- 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 toERROR.- Parameters:
minimumSeverity- the minimum priority- Returns:
- the priorities starting from the specified priority
-
getPredefinedValues
public static Set<Severity> getPredefinedValues()
Returns the set of predefinedSeverityinstances.- 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:
trueif this instance has the same name,falseotherwise
-
-