Class SuppressionCommentFilter.Tag
- java.lang.Object
-
- com.puppycrawl.tools.checkstyle.filters.SuppressionCommentFilter.Tag
-
- All Implemented Interfaces:
java.lang.Comparable<SuppressionCommentFilter.Tag>
- Enclosing class:
- SuppressionCommentFilter
public static class SuppressionCommentFilter.Tag extends java.lang.Object implements java.lang.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
Fields Modifier and Type Field Description private intcolumnThe column number of the tag.private intlineThe line number of the tag.private booleanreportingOnDetermines whether the suppression turns checkstyle reporting on.private java.util.regex.PatterntagCheckRegexpThe parsed check regexp, expanded for the text of this tag.private java.util.regex.PatterntagMessageRegexpThe parsed message regexp, expanded for the text of this tag.private java.lang.StringtextThe text of the tag.
-
Constructor Summary
Constructors Constructor Description Tag(int line, int column, java.lang.String text, boolean reportingOn, SuppressionCommentFilter filter)Constructs a tag.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(SuppressionCommentFilter.Tag object)Compares the position of this tag in the file with the position of another tag.booleanequals(java.lang.Object other)intgetColumn()Determines the column number of the tag in the source file.intgetLine()Returns line number of the tag in the source file.inthashCode()booleanisMatch(AuditEvent event)Determines whether the source of an audit event matches the text of this tag.booleanisReportingOn()Determines whether the suppression turns checkstyle reporting on or off.java.lang.StringtoString()
-
-
-
Field Detail
-
text
private final java.lang.String text
The text of the tag.
-
line
private final int line
The line number of the tag.
-
column
private final int column
The column number of the tag.
-
reportingOn
private final boolean reportingOn
Determines whether the suppression turns checkstyle reporting on.
-
tagCheckRegexp
private final java.util.regex.Pattern tagCheckRegexp
The parsed check regexp, expanded for the text of this tag.
-
tagMessageRegexp
private final java.util.regex.Pattern tagMessageRegexp
The parsed message regexp, expanded for the text of this tag.
-
-
Constructor Detail
-
Tag
public Tag(int line, int column, java.lang.String text, boolean reportingOn, SuppressionCommentFilter filter)Constructs a tag.- Parameters:
line- the line number.column- the column number.text- the text of the suppression.reportingOn-trueif the tag turns checkstyle reporting.filter- theSuppressionCommentFilterwith the context- Throws:
java.lang.IllegalArgumentException- if unable to parse expanded text.
-
-
Method Detail
-
getLine
public int getLine()
Returns line number of the tag in the source file.- Returns:
- the line number of the tag in the source file.
-
getColumn
public int 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.
-
isReportingOn
public boolean isReportingOn()
Determines whether the suppression turns checkstyle reporting on or off.- Returns:
trueif the suppression turns reporting on.
-
compareTo
public int compareTo(SuppressionCommentFilter.Tag object)
Compares the position of this tag in the file with the position of another tag.- Specified by:
compareToin interfacejava.lang.Comparable<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
public boolean equals(java.lang.Object other)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
isMatch
public boolean isMatch(AuditEvent event)
Determines whether the source of an audit event matches the text of this tag.- Parameters:
event- theAuditEventto check.- Returns:
- true if the source of event matches the text of this tag.
-
toString
public final java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-