Class Violation
- java.lang.Object
-
- org.apache.maven.plugins.checkstyle.Violation
-
class Violation extends java.lang.Object
Holds data about a single violation and represents the violation itself.
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.String
category
private java.lang.String
column
private java.lang.String
file
The absolute path of the file containing the violationprivate java.lang.String
line
private java.lang.String
message
protected static java.lang.String
NO_COLUMN
Indicates that a column is not set.private java.lang.String
ruleName
private java.lang.String
severity
private java.lang.String
source
The full qualified class name of the checkstyle rule
-
Constructor Summary
Constructors Constructor Description Violation(java.lang.String source, java.lang.String file, java.lang.String line, java.lang.String severity, java.lang.String message, java.lang.String ruleName, java.lang.String category)
Creates a violation instance without a column set.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object other)
protected java.lang.String
getCategory()
Returns the category of the current violation.protected java.lang.String
getColumn()
Returns the column in which the violation occurred, if available.protected java.lang.String
getFile()
Returns the absolute file path to the checked file.protected java.lang.String
getLine()
Returns the line in the checked file on which the violation occurred.protected java.lang.String
getMessage()
Returns the message produced by checkstyle for the current violation.protected java.lang.String
getRuleName()
Returns the name of the rule which led to the current violation.protected java.lang.String
getSeverity()
Returns the severity of the current violation.protected java.lang.String
getSource()
Returns the fully qualified class name of the checker rule.int
hashCode()
protected void
setColumn(java.lang.String column)
Sets the column value for this violation to the given string value.java.lang.String
toString()
-
-
-
Field Detail
-
NO_COLUMN
protected static final java.lang.String NO_COLUMN
Indicates that a column is not set.- See Also:
- Constant Field Values
-
source
private final java.lang.String source
The full qualified class name of the checkstyle rule
-
file
private final java.lang.String file
The absolute path of the file containing the violation
-
line
private final java.lang.String line
-
column
private java.lang.String column
-
severity
private final java.lang.String severity
-
message
private final java.lang.String message
-
ruleName
private final java.lang.String ruleName
-
category
private final java.lang.String category
-
-
Constructor Detail
-
Violation
Violation(java.lang.String source, java.lang.String file, java.lang.String line, java.lang.String severity, java.lang.String message, java.lang.String ruleName, java.lang.String category)
Creates a violation instance without a column set.- Parameters:
source
- the fully qualified class name of the checkstyle rulefile
- the absolute file path in which the violation occurredline
- the line in the file on which the violation occurredseverity
- the severity of the violationmessage
- the message from checkstyle for this violationruleName
- the rule name from which this violation was createdcategory
- the category of the checkstyle violation
-
-
Method Detail
-
getSource
protected java.lang.String getSource()
Returns the fully qualified class name of the checker rule.- Returns:
- the fully qualified class name of the checker rule
-
getFile
protected java.lang.String getFile()
Returns the absolute file path to the checked file.- Returns:
- the absolute file path to the checked file
-
getLine
protected java.lang.String getLine()
Returns the line in the checked file on which the violation occurred.- Returns:
- the line in the checked file on which the violation occurred
-
getColumn
protected java.lang.String getColumn()
Returns the column in which the violation occurred, if available.- Returns:
- the column in which the violation occurred, if available. Otherwise returns
NO_COLUMN
.
-
setColumn
protected void setColumn(java.lang.String column)
Sets the column value for this violation to the given string value.- Parameters:
column
- the column value to set. May benull
, which will set it to theNO_COLUMN
value.
-
getSeverity
protected java.lang.String getSeverity()
Returns the severity of the current violation.- Returns:
- the severity of the current violation
-
getMessage
protected java.lang.String getMessage()
Returns the message produced by checkstyle for the current violation.- Returns:
- the message produced by checkstyle for the current violation
-
getRuleName
protected java.lang.String getRuleName()
Returns the name of the rule which led to the current violation.- Returns:
- the name of the rule which led to the current violation
-
getCategory
protected java.lang.String getCategory()
Returns the category of the current violation.- Returns:
- the category of the current violation
-
equals
public boolean equals(java.lang.Object other)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-