Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.puppycrawl.tools.checkstyle.api
Class AbstractFileSetCheck

    java.lang.Object
      com.puppycrawl.tools.checkstyle.api.AutomaticBean
          com.puppycrawl.tools.checkstyle.api.AbstractViolationReporter
              com.puppycrawl.tools.checkstyle.api.AbstractFileSetCheck

All Implemented Interfaces:
  Configurable, Contextualizable, FileSetCheck

Direct Known Subclasses:
  NewlineAtEndOfFileCheck, PackageHtmlCheck, StrictDuplicateCodeCheck, TranslationCheck, TreeWalker

public abstract class AbstractFileSetCheck
extends AbstractViolationReporter
implements FileSetCheck

Provides common functionality for many FileSetChecks.

Author:
  lkuehne

Constructor Summary
`AbstractFileSetCheck()`

Method Summary
`void` | `destroy()` Cleans up the object.
`protected java.io.File[]` | `filter(java.io.File[] aFiles)` Determines the set of files this FileSetCheck is interested in.
`protected void` | `fireErrors(java.lang.String aFileName)` Notify all listeners about the errors in a file.
`protected LocalizedMessages` | `getMessageCollector()` Returns the collector for violation messages.
`protected MessageDispatcher` | `getMessageDispatcher()` A message dispatcher is used to fire violation messages to interested audit listeners.
`protected void` | `log(int aLineNo, int aColNo, java.lang.String aKey, java.lang.Object[] aArgs)` Adds a violation message to the `message collector`.
`protected void` | `log(int aLine, java.lang.String aKey, java.lang.Object[] aArgs)` Adds a violation message to the `message collector`.
`void` | `setFileExtensions(java.lang.String[] aExtensions)` Sets the file extensions that identify the files that pass the filter of this FileSetCheck.
`void` | `setMessageDispatcher(MessageDispatcher aDispatcher)` Sets the MessageDispatcher that is used to dispatch error messages to AuditListeners during processing.

Methods inherited from class com.puppycrawl.tools.checkstyle.api.AbstractViolationReporter
`getMessageBundle, getSeverity, getSeverityLevel, log, log, log, log, log, log, log, log, log, setSeverity`

Methods inherited from class com.puppycrawl.tools.checkstyle.api.AutomaticBean
`configure, contextualize, finishLocalSetup, getConfiguration, setupChild`

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

Methods inherited from interface com.puppycrawl.tools.checkstyle.api.FileSetCheck
`process`

Methods inherited from interface com.puppycrawl.tools.checkstyle.api.Configurable
`configure`

Methods inherited from interface com.puppycrawl.tools.checkstyle.api.Contextualizable
`contextualize`

Constructor Detail

### AbstractFileSetCheck

    public AbstractFileSetCheck()

Method Detail

### destroy

    public void destroy()

  Description copied from interface: `FileSetCheck`
  Cleans up the object.

  Specified by:
    `destroy` in interface `FileSetCheck`
  See Also:
    `FileSetCheck`

### setMessageDispatcher

    public final void setMessageDispatcher(MessageDispatcher aDispatcher)

  Description copied from interface: `FileSetCheck`
  Sets the MessageDispatcher that is used to dispatch error messages to AuditListeners during processing.

  Specified by:
    `setMessageDispatcher` in interface `FileSetCheck`
  Parameters:
    `aDispatcher` - the dispatcher
  See Also:
    `FileSetCheck`

### getMessageDispatcher

    protected final MessageDispatcher getMessageDispatcher()

  A message dispatcher is used to fire violation messages to interested audit listeners.

  Returns:
    the current MessageDispatcher.

### filter

    protected final java.io.File[] filter(java.io.File[] aFiles)

  Determines the set of files this FileSetCheck is interested in. Returns the files that have one of the currently active file extensions. If no file extensions are active the argument array is returned.

  This method can be used in the implementation of `process()` to filter it's argument list for interesting files.

  Parameters:
    `aFiles` - the candidates for processing
  Returns:
    the subset of aFiles that this FileSetCheck should process
  See Also:
    `FileSetCheck.process(java.io.File[])`

### setFileExtensions

    public final void setFileExtensions(java.lang.String[] aExtensions)

  Sets the file extensions that identify the files that pass the filter of this FileSetCheck.

  Parameters:
    `aExtensions` - the set of file extensions. A missing initial '.' character of an extension is automatically added.

### getMessageCollector

    protected final LocalizedMessages getMessageCollector()

  Returns the collector for violation messages. Subclasses can use the collector to find out the violation messages to fire via the message dispatcher.

  Returns:
    the collector for localized messages.

### log

    protected final void log(int aLine,
                             java.lang.String aKey,
                             java.lang.Object[] aArgs)

  Adds a violation message to the `message collector`.

  Specified by:
    `log` in class `AbstractViolationReporter`
  Parameters:
    `aLine` - the line number where the error was found
    `aKey` - the message that describes the error
    `aArgs` - the details of the message
  See Also:
    `AbstractViolationReporter.log(int, String, Object[])`

### log

    protected final void log(int aLineNo,
                             int aColNo,
                             java.lang.String aKey,
                             java.lang.Object[] aArgs)

  Adds a violation message to the `message collector`.

  Specified by:
    `log` in class `AbstractViolationReporter`
  Parameters:
    `aLineNo` - the line number where the error was found
    `aColNo` - the column number where the error was found
    `aKey` - the message that describes the error
    `aArgs` - the details of the message
  See Also:
    `AbstractViolationReporter.log(int, int, String, Object[])`

### fireErrors

    protected final void fireErrors(java.lang.String aFileName)

  Notify all listeners about the errors in a file. Calls `MessageDispatcher.fireErrors()` with all logged errors and than clears errors' list.

  Parameters:
    `aFileName` - the audited file

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Back to the Checkstyle Home Page
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD