Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.puppycrawl.tools.checkstyle.api
Class SeverityLevel  view SeverityLevel download SeverityLevel.java

java.lang.Object
  extended bycom.puppycrawl.tools.checkstyle.api.SeverityLevel
All Implemented Interfaces:
java.lang.Comparable, java.io.Serializable

public final class SeverityLevel
extends java.lang.Object
implements java.lang.Comparable, java.io.Serializable

Severity level for a check violation.

Each violation of an audit check is assigned one of the severity levels defined here.


Field Summary
static SeverityLevel ERROR
          Severity level: error.
static SeverityLevel IGNORE
          Severity level: ignore.
static SeverityLevel INFO
          Severity level: informational.
private  int mCode
          the SEVERITYCODE_XYZ value of this severity level.
private  java.lang.String mName
          the name of this severity level.
private static java.util.Map NAME_TO_LEVEL
          map from level names to the respective level
private static int SEVERITYCODE_ERROR
          Numeric value for severity level ERROR
private static int SEVERITYCODE_IGNORE
          Numeric value for severity level IGNORE
private static int SEVERITYCODE_INFO
          Numeric value for severity level INFO
private static int SEVERITYCODE_WARNING
          Numeric value for severity level WARNING
private static java.lang.String SEVERITYNAME_ERROR
          Name for severity level ERROR
private static java.lang.String SEVERITYNAME_IGNORE
          Name for severity level IGNORE
private static java.lang.String SEVERITYNAME_INFO
          Name for severity level INFO
private static java.lang.String SEVERITYNAME_WARNING
          Name for severity level WARNING
static SeverityLevel WARNING
          Severity level: warning.
 
Constructor Summary
private SeverityLevel(int aCode, java.lang.String aName)
          Creates a new SeverityLevel instance.
 
Method Summary
 int compareTo(java.lang.Object aObject)
          Compares this object with another, and returns a numerical result based on the comparison.
 boolean equals(java.lang.Object aObj)
          The equals method.
static SeverityLevel getInstance(java.lang.String aSeverityName)
          SeverityLevel factory method.
 java.lang.String getName()
           
 int hashCode()
          The hashCode method.
private  java.lang.Object readResolve()
          Ensures that we don't get multiple instances of one SeverityLevel during deserialization.
 java.lang.String toString()
          Convert this Object to a human-readable String.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

SEVERITYCODE_IGNORE

private static final int SEVERITYCODE_IGNORE
Numeric value for severity level IGNORE

See Also:
Constant Field Values

SEVERITYCODE_INFO

private static final int SEVERITYCODE_INFO
Numeric value for severity level INFO

See Also:
Constant Field Values

SEVERITYCODE_WARNING

private static final int SEVERITYCODE_WARNING
Numeric value for severity level WARNING

See Also:
Constant Field Values

SEVERITYCODE_ERROR

private static final int SEVERITYCODE_ERROR
Numeric value for severity level ERROR

See Also:
Constant Field Values

SEVERITYNAME_IGNORE

private static final java.lang.String SEVERITYNAME_IGNORE
Name for severity level IGNORE

See Also:
Constant Field Values

SEVERITYNAME_INFO

private static final java.lang.String SEVERITYNAME_INFO
Name for severity level INFO

See Also:
Constant Field Values

SEVERITYNAME_WARNING

private static final java.lang.String SEVERITYNAME_WARNING
Name for severity level WARNING

See Also:
Constant Field Values

SEVERITYNAME_ERROR

private static final java.lang.String SEVERITYNAME_ERROR
Name for severity level ERROR

See Also:
Constant Field Values

IGNORE

public static final SeverityLevel IGNORE
Severity level: ignore. This is the lowest severity level.


INFO

public static final SeverityLevel INFO
Severity level: informational.


WARNING

public static final SeverityLevel WARNING
Severity level: warning.


ERROR

public static final SeverityLevel ERROR
Severity level: error. This is the highest severity level.


NAME_TO_LEVEL

private static final java.util.Map NAME_TO_LEVEL
map from level names to the respective level


mCode

private final int mCode
the SEVERITYCODE_XYZ value of this severity level.


mName

private final java.lang.String mName
the name of this severity level.

Constructor Detail

SeverityLevel

private SeverityLevel(int aCode,
                      java.lang.String aName)
Creates a new SeverityLevel instance.

Method Detail

toString

public java.lang.String toString()
Description copied from class: java.lang.Object
Convert this Object to a human-readable String. There are no limits placed on how long this String should be or what it should contain. We suggest you make it as intuitive as possible to be able to place it into System.out.println() 55 and such.

It is typical, but not required, to ensure that this method never completes abruptly with a java.lang.RuntimeException.

This method will be called when performing string concatenation with this object. If the result is null, string concatenation will instead use "null".

The default implementation returns getClass().getName() + "@" + Integer.toHexString(hashCode()).


getName

public java.lang.String getName()

compareTo

public int compareTo(java.lang.Object aObject)
Description copied from interface: java.lang.Comparable
Compares this object with another, and returns a numerical result based on the comparison. If the result is negative, this object sorts less than the other; if 0, the two are equal, and if positive, this object sorts greater than the other. To translate this into boolean, simply perform o1.compareTo(o2) <op> 0, where op is one of <, <=, =, !=, >, or >=.

You must make sure that the comparison is mutual, ie. sgn(x.compareTo(y)) == -sgn(y.compareTo(x)) (where sgn() is defined as -1, 0, or 1 based on the sign). This includes throwing an exception in either direction if the two are not comparable; hence, compareTo(null) should always throw an Exception.

You should also ensure transitivity, in two forms: x.compareTo(y) > 0 && y.compareTo(z) > 0 implies x.compareTo(z) > 0; and x.compareTo(y) == 0 implies x.compareTo(z) == y.compareTo(z).

Specified by:
compareTo in interface java.lang.Comparable

equals

public boolean equals(java.lang.Object aObj)
The equals method.


hashCode

public int hashCode()
The hashCode method.


getInstance

public static SeverityLevel getInstance(java.lang.String aSeverityName)
SeverityLevel factory method.


readResolve

private java.lang.Object readResolve()
Ensures that we don't get multiple instances of one SeverityLevel during deserialization. See Section 3.6 of the Java Object Serialization Specification for details.