Class SuppressWithNearbyTextFilter.Suppression
- java.lang.Object
-
- com.puppycrawl.tools.checkstyle.filters.SuppressWithNearbyTextFilter.Suppression
-
- Enclosing class:
- SuppressWithNearbyTextFilter
private static final class SuppressWithNearbyTextFilter.Suppression extends java.lang.Object
The class which represents the suppression.
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.regex.PatterneventIdRegexpThe regexp which is used to match the event ID.private java.util.regex.PatterneventMessageRegexpThe regexp which is used to match the event message.private java.util.regex.PatterneventSourceRegexpThe regexp which is used to match the event source.private intfirstLineThe first line where warnings may be suppressed.private intlastLineThe last line where warnings may be suppressed.
-
Constructor Summary
Constructors Modifier Constructor Description privateSuppression(java.lang.String text, int lineNo, SuppressWithNearbyTextFilter filter)Constructs newSuppressioninstance.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private booleanisCheckMatch(AuditEvent event)Checks whetherAuditEventsource name matches the check pattern.private booleanisIdMatch(AuditEvent event)Checks whether theAuditEventmodule ID matches the ID pattern.private booleanisInScopeOfSuppression(AuditEvent event)Checks whether theAuditEventis in the scope of the suppression.private booleanisMatch(AuditEvent event)Determines whether the source of an audit event matches the text of this suppression.private booleanisMessageMatch(AuditEvent event)Checks whether theAuditEventmessage matches the message pattern.private static intparseRange(java.lang.String format, java.lang.String lineRange, java.lang.String text)Gets range from suppress filter range format param.
-
-
-
Field Detail
-
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.
-
eventSourceRegexp
private final java.util.regex.Pattern eventSourceRegexp
The regexp which is used to match the event source.
-
eventMessageRegexp
private java.util.regex.Pattern eventMessageRegexp
The regexp which is used to match the event message.
-
eventIdRegexp
private java.util.regex.Pattern eventIdRegexp
The regexp which is used to match the event ID.
-
-
Constructor Detail
-
Suppression
private Suppression(java.lang.String text, int lineNo, SuppressWithNearbyTextFilter filter)
Constructs newSuppressioninstance.- Parameters:
text- suppression text.lineNo- suppression line number.filter- theSuppressWithNearbyTextFilterwith the context.- Throws:
java.lang.IllegalArgumentException- if there is an error in the filter regex syntax.
-
-
Method Detail
-
parseRange
private static int parseRange(java.lang.String format, java.lang.String lineRange, java.lang.String text)
Gets range from suppress filter range format param.- Parameters:
format- range format to parselineRange- raw line rangetext- text of the suppression- Returns:
- parsed range
- Throws:
java.lang.IllegalArgumentException- when unable to parse int in format
-
isMatch
private boolean isMatch(AuditEvent event)
Determines whether the source of an audit event matches the text of this suppression.- Parameters:
event- theAuditEventto check.- Returns:
- true if the source of event matches the text of this suppression.
-
isInScopeOfSuppression
private boolean isInScopeOfSuppression(AuditEvent event)
Checks whether theAuditEventis in the scope of the suppression.- Parameters:
event-AuditEventinstance.- Returns:
- true if the
AuditEventis in the scope of the suppression.
-
isCheckMatch
private boolean isCheckMatch(AuditEvent event)
Checks whetherAuditEventsource name matches the check pattern.- Parameters:
event-AuditEventinstance.- Returns:
- true if the
AuditEventsource name matches the check pattern.
-
isIdMatch
private boolean isIdMatch(AuditEvent event)
Checks whether theAuditEventmodule ID matches the ID pattern.- Parameters:
event-AuditEventinstance.- Returns:
- true if the
AuditEventmodule ID matches the ID pattern.
-
isMessageMatch
private boolean isMessageMatch(AuditEvent event)
Checks whether theAuditEventmessage matches the message pattern.- Parameters:
event-AuditEventinstance.- Returns:
- true if the
AuditEventmessage matches the message pattern.
-
-