Class SuppressionCommentFilter.Tag
java.lang.Object
com.puppycrawl.tools.checkstyle.filters.SuppressionCommentFilter.Tag
- All Implemented Interfaces:
Comparable<SuppressionCommentFilter.Tag>
- Enclosing class:
SuppressionCommentFilter
private static final class SuppressionCommentFilter.Tag
extends Object
implements Comparable<SuppressionCommentFilter.Tag>
A Tag holds a suppression comment and its location, and determines
whether the suppression turns checkstyle reporting on or off.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final intThe column number of the tag.private final intThe line number of the tag.private final PatternThe parsed check regexp, expanded for the text of this tag.private final PatternThe parsed check ID regexp, expanded for the text of this tag.private final PatternThe parsed message regexp, expanded for the text of this tag.private final SuppressionCommentFilter.TagTypeDetermines whether the suppression turns checkstyle reporting on.private final StringThe text of the tag. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateTag(int line, int column, String text, SuppressionCommentFilter.TagType tagType, SuppressionCommentFilter filter) Constructs a tag. -
Method Summary
Modifier and TypeMethodDescriptionintCompares the position of this tag in the file with the position of another tag.booleanIndicates whether some other object is "equal to" this one.intDetermines the column number of the tag in the source file.intgetLine()Returns line number of the tag in the source file.Determines whether the suppression turns checkstyle reporting on or off.inthashCode()private booleanisCheckMatch(TreeWalkerAuditEvent event) Checks whetherTreeWalkerAuditEventsource name matches the check format.private booleanisIdMatch(TreeWalkerAuditEvent event) Checks whether theTreeWalkerAuditEventmodule ID matches the ID format.booleanisMatch(TreeWalkerAuditEvent event) Determines whether the source of an audit event matches the text of this tag.private booleanChecks whether theTreeWalkerAuditEventmessage matches the message format.toString()
-
Field Details
-
text
The text of the tag. -
line
The line number of the tag. -
column
The column number of the tag. -
tagType
Determines whether the suppression turns checkstyle reporting on. -
tagCheckRegexp
The parsed check regexp, expanded for the text of this tag. -
tagMessageRegexp
The parsed message regexp, expanded for the text of this tag. -
tagIdRegexp
The parsed check ID regexp, expanded for the text of this tag.
-
-
Constructor Details
-
Tag
private Tag(int line, int column, String text, SuppressionCommentFilter.TagType tagType, SuppressionCommentFilter filter) Constructs a tag.- Parameters:
line- the line number.column- the column number.text- the text of the suppression.tagType-ONif the tag turns checkstyle reporting.filter- theSuppressionCommentFilterwith the context- Throws:
IllegalArgumentException- if unable to parse expanded text.
-
-
Method Details
-
getLine
Returns line number of the tag in the source file.- Returns:
- the line number of the tag in the source file.
-
getColumn
Determines the column number of the tag in the source file. Will be 0 for all lines of multiline comment, except the first line.- Returns:
- the column number of the tag in the source file.
-
getTagType
Determines whether the suppression turns checkstyle reporting on or off.- Returns:
ONif the suppression turns reporting on.
-
compareTo
Compares the position of this tag in the file with the position of another tag.- Specified by:
compareToin interfaceComparable<SuppressionCommentFilter.Tag>- Parameters:
object- the tag to compare with this one.- Returns:
- a negative number if this tag is before the other tag, 0 if they are at the same position, and a positive number if this tag is after the other tag.
-
equals
Indicates whether some other object is "equal to" this one. Suppression on enumeration is needed so code stays consistent. -
hashCode
-
isMatch
Determines whether the source of an audit event matches the text of this tag.- Parameters:
event- theTreeWalkerAuditEventto check.- Returns:
- true if the source of event matches the text of this tag.
-
isCheckMatch
Checks whetherTreeWalkerAuditEventsource name matches the check format.- Parameters:
event-TreeWalkerAuditEventinstance.- Returns:
- true if the
TreeWalkerAuditEventsource name matches the check format.
-
isIdMatch
Checks whether theTreeWalkerAuditEventmodule ID matches the ID format.- Parameters:
event-TreeWalkerAuditEventinstance.- Returns:
- true if the
TreeWalkerAuditEventmodule ID matches the ID format.
-
isMessageMatch
Checks whether theTreeWalkerAuditEventmessage matches the message format.- Parameters:
event-TreeWalkerAuditEventinstance.- Returns:
- true if the
TreeWalkerAuditEventmessage matches the message format.
-
toString
-