## com.puppycrawl.tools.checkstyle.filters
Class SuppressElement

    java.lang.Object
      com.puppycrawl.tools.checkstyle.filters.SuppressElement

All Implemented Interfaces:
  Filter

    public class SuppressElement

extends 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.

Author:
  Rick Giles

Constructor Summary
`SuppressElement(String aFiles)` Constructs a `SuppressElement` for a file name pattern.

Method Summary
`boolean` `accept(AuditEvent aEvent)` Determines whether or not a filtered AuditEvent is accepted.
`boolean` `equals(Object aObject)`
`int` `hashCode()`
`void` `setChecks(String aChecks)` Set the check class pattern.
`void` `setColumns(String aColumns)` Sets the CSV values and ranges for column number filtering.
`void` `setLines(String aLines)` Sets the CSV values and ranges for line number filtering.
`void` `setModuleId(String aModuleId)` Set the module id for filtering.
`String` `toString()`

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

Constructor Detail

### SuppressElement

    public SuppressElement(String aFiles)
                    throws PatternSyntaxException

  Constructs a `SuppressElement` for a file name pattern. Must either call `setColumns(String)` or `setModuleId(String)` before using this object.

  Parameters:
    `aFiles` - regular expression for names of filtered files.
  Throws:
    `PatternSyntaxException` - if there is an error.

Method Detail

### setChecks

    public void setChecks(String aChecks)

  Set the check class pattern.

  Parameters:
    `aChecks` - regular expression for filtered check classes.

### setModuleId

    public void setModuleId(String aModuleId)

  Set the module id for filtering. Cannot be null.

  Parameters:
    `aModuleId` - the id

### setLines

    public void setLines(String aLines)

  Sets the CSV values and ranges for line number filtering. E.g. "1,7-15,18".

  Parameters:
    `aLines` - CSV values and ranges for line number filtering.

### setColumns

    public void setColumns(String aColumns)

  Sets the CSV values and ranges for column number filtering. E.g. "1,7-15,18".

  Parameters:
    `aColumns` - CSV values and ranges for column number filtering.

### accept

    public boolean accept(AuditEvent aEvent)

  Determines whether or not a filtered AuditEvent is accepted.

  Specified by:
    `accept` in interface `Filter`
  Parameters:
    `aEvent` - the AudtiEvent to filter.
  Returns:
    true if the aEvent is accepted.

### toString

    public String toString()

  Overrides:
    `toString` in class `Object`

### hashCode

    public int hashCode()

  Overrides:
    `hashCode` in class `Object`

### equals

    public boolean equals(Object aObject)

  Overrides:
    `equals` in class `Object`

Back to the Checkstyle Home Page