Class SuppressWithNearbyCommentFilter.Tag
- java.lang.Object
-
- com.puppycrawl.tools.checkstyle.filters.SuppressWithNearbyCommentFilter.Tag
-
- Enclosing class:
- SuppressWithNearbyCommentFilter
private static final class SuppressWithNearbyCommentFilter.Tag extends java.lang.Object
A Tag holds a suppression comment and its location.
-
-
Field Summary
Fields Modifier and Type Field Description private intfirstLineThe first line where warnings may be suppressed.private intlastLineThe last line where warnings may be suppressed.private java.util.regex.PatterntagCheckRegexpThe parsed check regexp, expanded for the text of this tag.private java.util.regex.PatterntagIdRegexpThe parsed check ID 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(java.lang.String text, int line, SuppressWithNearbyCommentFilter filter)Constructs a tag.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object other)inthashCode()private booleanisCheckMatch(TreeWalkerAuditEvent event)Checks whetherTreeWalkerAuditEventsource name matches the check format.private booleanisIdMatch(TreeWalkerAuditEvent event)Checks whether theTreeWalkerAuditEventmodule ID matches the ID format.private booleanisInScopeOfSuppression(TreeWalkerAuditEvent event)Checks whether theTreeWalkerAuditEventis in the scope of the suppression.booleanisMatch(TreeWalkerAuditEvent event)Determines whether the source of an audit event matches the text of this tag.private booleanisMessageMatch(TreeWalkerAuditEvent event)Checks whether theTreeWalkerAuditEventmessage matches the message format.private static intparseInfluence(java.lang.String format, java.lang.String influenceFormat, java.lang.String text)Gets influence from suppress filter influence format param.java.lang.StringtoString()
-
-
-
Field Detail
-
text
private final java.lang.String text
The text of the tag.
-
firstLine
private final int firstLine
The first line where warnings may be suppressed.
-
lastLine
private final int lastLine
The last line where warnings may be suppressed.
-
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.
-
tagIdRegexp
private final java.util.regex.Pattern tagIdRegexp
The parsed check ID regexp, expanded for the text of this tag.
-
-
Constructor Detail
-
Tag
Tag(java.lang.String text, int line, SuppressWithNearbyCommentFilter filter)
Constructs a tag.- Parameters:
text- the text of the suppression.line- the line number.filter- theSuppressWithNearbyCommentFilterwith the context- Throws:
java.lang.IllegalArgumentException- if unable to parse expanded text.
-
-
Method Detail
-
parseInfluence
private static int parseInfluence(java.lang.String format, java.lang.String influenceFormat, java.lang.String text)
Gets influence from suppress filter influence format param.- Parameters:
format- influence format to parseinfluenceFormat- raw influence formattext- text of the suppression- Returns:
- parsed influence
- Throws:
java.lang.IllegalArgumentException- when unable to parse int in format
-
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(TreeWalkerAuditEvent event)
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.
-
isInScopeOfSuppression
private boolean isInScopeOfSuppression(TreeWalkerAuditEvent event)
Checks whether theTreeWalkerAuditEventis in the scope of the suppression.- Parameters:
event-TreeWalkerAuditEventinstance.- Returns:
- true if the
TreeWalkerAuditEventis in the scope of the suppression.
-
isCheckMatch
private boolean isCheckMatch(TreeWalkerAuditEvent event)
Checks whetherTreeWalkerAuditEventsource name matches the check format.- Parameters:
event-TreeWalkerAuditEventinstance.- Returns:
- true if the
TreeWalkerAuditEventsource name matches the check format.
-
isIdMatch
private boolean isIdMatch(TreeWalkerAuditEvent event)
Checks whether theTreeWalkerAuditEventmodule ID matches the ID format.- Parameters:
event-TreeWalkerAuditEventinstance.- Returns:
- true if the
TreeWalkerAuditEventmodule ID matches the ID format.
-
isMessageMatch
private boolean isMessageMatch(TreeWalkerAuditEvent event)
Checks whether theTreeWalkerAuditEventmessage matches the message format.- Parameters:
event-TreeWalkerAuditEventinstance.- Returns:
- true if the
TreeWalkerAuditEventmessage matches the message format.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-