Class SuppressFilterElement
- java.lang.Object
-
- com.puppycrawl.tools.checkstyle.filters.SuppressFilterElement
-
- All Implemented Interfaces:
Filter
public class SuppressFilterElement extends java.lang.Object implements Filter
This filter element is immutable and processesAuditEventobjects based on the criteria of file, check, module id, line, and column. It rejects an AuditEvent if the following match:- the event's file name; and
- the check name or the module identifier; and
- (optionally) the event's line is in the filter's line CSV; and
- (optionally) the check's columns is in the filter's column CSV.
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.StringcheckPatternThe pattern for check class names.private java.util.regex.PatterncheckRegexpThe regexp to match check names against.private CsvFilterElementcolumnFilterColumn number filter.private java.lang.StringcolumnsCsvCSV for column number filter.private java.lang.StringfilePatternThe pattern for file names.private java.util.regex.PatternfileRegexpThe regexp to match file names against.private CsvFilterElementlineFilterLine number filter.private java.lang.StringlinesCsvCSV for line number filter.private java.lang.StringmessagePatternThe pattern for message names.private java.util.regex.PatternmessageRegexpThe regexp to match message names against.private java.lang.StringmoduleIdModule id filter.
-
Constructor Summary
Constructors Constructor Description SuppressFilterElement(java.lang.String files, java.lang.String checks, java.lang.String message, java.lang.String modId, java.lang.String lines, java.lang.String columns)Constructs aSuppressFilterElementfor a file name pattern.SuppressFilterElement(java.util.regex.Pattern files, java.util.regex.Pattern checks, java.util.regex.Pattern message, java.lang.String moduleId, java.lang.String lines, java.lang.String columns)Creates aSuppressFilterElementinstance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanaccept(AuditEvent event)Determines whether or not a filtered AuditEvent is accepted.booleanequals(java.lang.Object other)inthashCode()private booleanisFileNameAndModuleNameMatching(AuditEvent event)Is matching by file name, module id, and Check name.private booleanisLineAndColumnMatching(AuditEvent event)Whether line and column match.private booleanisMessageNameMatching(AuditEvent event)Is matching by message.
-
-
-
Field Detail
-
fileRegexp
private final java.util.regex.Pattern fileRegexp
The regexp to match file names against.
-
filePattern
private final java.lang.String filePattern
The pattern for file names.
-
checkRegexp
private final java.util.regex.Pattern checkRegexp
The regexp to match check names against.
-
checkPattern
private final java.lang.String checkPattern
The pattern for check class names.
-
messageRegexp
private final java.util.regex.Pattern messageRegexp
The regexp to match message names against.
-
messagePattern
private final java.lang.String messagePattern
The pattern for message names.
-
moduleId
private final java.lang.String moduleId
Module id filter.
-
lineFilter
private final CsvFilterElement lineFilter
Line number filter.
-
linesCsv
private final java.lang.String linesCsv
CSV for line number filter.
-
columnFilter
private final CsvFilterElement columnFilter
Column number filter.
-
columnsCsv
private final java.lang.String columnsCsv
CSV for column number filter.
-
-
Constructor Detail
-
SuppressFilterElement
public SuppressFilterElement(java.lang.String files, java.lang.String checks, java.lang.String message, java.lang.String modId, java.lang.String lines, java.lang.String columns)
Constructs aSuppressFilterElementfor a file name pattern.- Parameters:
files- regular expression for names of filtered files.checks- regular expression for filtered check classes.message- regular expression for messages.modId- the idlines- lines CSV values and ranges for line number filtering.columns- columns CSV values and ranges for column number filtering.
-
SuppressFilterElement
public SuppressFilterElement(java.util.regex.Pattern files, java.util.regex.Pattern checks, java.util.regex.Pattern message, java.lang.String moduleId, java.lang.String lines, java.lang.String columns)
Creates aSuppressFilterElementinstance.- Parameters:
files- regular expression for filtered file nameschecks- regular expression for filtered check classesmessage- regular expression for messages.moduleId- the module idlines- CSV for linescolumns- CSV for columns
-
-
Method Detail
-
accept
public boolean accept(AuditEvent event)
Description copied from interface:FilterDetermines whether or not a filtered AuditEvent is accepted.
-
isFileNameAndModuleNameMatching
private boolean isFileNameAndModuleNameMatching(AuditEvent event)
Is matching by file name, module id, and Check name.- Parameters:
event- event- Returns:
- true if it is matching
-
isMessageNameMatching
private boolean isMessageNameMatching(AuditEvent event)
Is matching by message.- Parameters:
event- event- Returns:
- true if it is matching or not set.
-
isLineAndColumnMatching
private boolean isLineAndColumnMatching(AuditEvent event)
Whether line and column match.- Parameters:
event- event to process.- Returns:
- true if line and column are matching or not set.
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object other)
- Overrides:
equalsin classjava.lang.Object
-
-