Class Violation
java.lang.Object
org.apache.maven.plugins.checkstyle.Violation
Holds data about a single violation and represents the violation itself.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Stringprivate Stringprivate final StringThe absolute path of the file containing the violationprivate final Stringprivate final Stringprotected static final StringIndicates that a column is not set.private final Stringprivate final Stringprivate final StringThe full qualified class name of the checkstyle rule -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanprotected StringReturns the category of the current violation.protected StringReturns the column in which the violation occurred, if available.protected StringgetFile()Returns the absolute file path to the checked file.protected StringgetLine()Returns the line in the checked file on which the violation occurred.protected StringReturns the message produced by checkstyle for the current violation.protected StringReturns the name of the rule which led to the current violation.protected StringReturns the severity of the current violation.protected StringReturns the fully qualified class name of the checker rule.inthashCode()protected voidSets the column value for this violation to the given string value.toString()
-
Field Details
-
NO_COLUMN
Indicates that a column is not set.- See Also:
-
source
The full qualified class name of the checkstyle rule -
file
The absolute path of the file containing the violation -
line
-
column
-
severity
-
message
-
ruleName
-
category
-
-
Constructor Details
-
Violation
Violation(String source, String file, String line, String severity, String message, String ruleName, 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 Details
-
getSource
Returns the fully qualified class name of the checker rule.- Returns:
- the fully qualified class name of the checker rule
-
getFile
Returns the absolute file path to the checked file.- Returns:
- the absolute file path to the checked file
-
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
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
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_COLUMNvalue.
-
getSeverity
Returns the severity of the current violation.- Returns:
- the severity of the current violation
-
getMessage
Returns the message produced by checkstyle for the current violation.- Returns:
- the message produced by checkstyle for the current violation
-
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
Returns the category of the current violation.- Returns:
- the category of the current violation
-
equals
-
hashCode
public int hashCode() -
toString
-