Class SuppressElement

  • All Implemented Interfaces:
    Filter

    public class SuppressElement
    extends java.lang.Object
    implements Filter
    This filter processes AuditEvent objects 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.String checkPattern
      The pattern for check class names.
      private java.util.regex.Pattern checkRegexp
      The regexp to match check names against.
      private CsvFilter columnFilter
      Column number filter.
      private java.lang.String columnsCsv
      CSV for column number filter.
      private java.lang.String filePattern
      The pattern for file names.
      private java.util.regex.Pattern fileRegexp
      The regexp to match file names against.
      private CsvFilter lineFilter
      Line number filter.
      private java.lang.String linesCsv
      CSV for line number filter.
      private java.lang.String moduleId
      Module id filter.
    • Constructor Summary

      Constructors 
      Constructor Description
      SuppressElement​(java.lang.String files)
      Constructs a SuppressElement for a file name pattern.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean accept​(AuditEvent event)
      Determines whether or not a filtered AuditEvent is accepted.
      boolean equals​(java.lang.Object other)  
      int hashCode()  
      private boolean isFileNameAndModuleNotMatching​(AuditEvent event)
      Is matching by file name and Check name.
      private boolean isLineAndColumnMatch​(AuditEvent event)
      Whether line and column match.
      void setChecks​(java.lang.String checks)
      Set the check class pattern.
      void setColumns​(java.lang.String columns)
      Sets the CSV values and ranges for column number filtering.
      void setLines​(java.lang.String lines)
      Sets the CSV values and ranges for line number filtering.
      void setModuleId​(java.lang.String moduleId)
      Set the module id for filtering.
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
    • 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 java.util.regex.Pattern checkRegexp
        The regexp to match check names against.
      • checkPattern

        private java.lang.String checkPattern
        The pattern for check class names.
      • moduleId

        private java.lang.String moduleId
        Module id filter.
      • lineFilter

        private CsvFilter lineFilter
        Line number filter.
      • linesCsv

        private java.lang.String linesCsv
        CSV for line number filter.
      • columnFilter

        private CsvFilter columnFilter
        Column number filter.
      • columnsCsv

        private java.lang.String columnsCsv
        CSV for column number filter.
    • Constructor Detail

      • SuppressElement

        public SuppressElement​(java.lang.String files)
        Constructs a SuppressElement for a file name pattern. Must either call setColumns(String) or setModuleId(String) before using this object.
        Parameters:
        files - regular expression for names of filtered files.
    • Method Detail

      • setChecks

        public void setChecks​(java.lang.String checks)
        Set the check class pattern.
        Parameters:
        checks - regular expression for filtered check classes.
      • setModuleId

        public void setModuleId​(java.lang.String moduleId)
        Set the module id for filtering. Cannot be null.
        Parameters:
        moduleId - the id
      • setLines

        public void setLines​(java.lang.String lines)
        Sets the CSV values and ranges for line number filtering. E.g. "1,7-15,18".
        Parameters:
        lines - CSV values and ranges for line number filtering.
      • setColumns

        public void setColumns​(java.lang.String columns)
        Sets the CSV values and ranges for column number filtering. E.g. "1,7-15,18".
        Parameters:
        columns - CSV values and ranges for column number filtering.
      • accept

        public boolean accept​(AuditEvent event)
        Description copied from interface: Filter
        Determines whether or not a filtered AuditEvent is accepted.
        Specified by:
        accept in interface Filter
        Parameters:
        event - the AuditEvent to filter.
        Returns:
        true if the event is accepted.
      • isFileNameAndModuleNotMatching

        private boolean isFileNameAndModuleNotMatching​(AuditEvent event)
        Is matching by file name and Check name.
        Parameters:
        event - event
        Returns:
        true is matching
      • isLineAndColumnMatch

        private boolean isLineAndColumnMatch​(AuditEvent event)
        Whether line and column match.
        Parameters:
        event - event to process.
        Returns:
        true if line and column match.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object other)
        Overrides:
        equals in class java.lang.Object