Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.puppycrawl.tools.checkstyle.api
Class AbstractFileSetCheck  view AbstractFileSetCheck download AbstractFileSetCheck.java

java.lang.Object
  extended bycom.puppycrawl.tools.checkstyle.api.AutomaticBean
      extended bycom.puppycrawl.tools.checkstyle.api.AbstractViolationReporter
          extended bycom.puppycrawl.tools.checkstyle.api.AbstractFileSetCheck
All Implemented Interfaces:
Configurable, Contextualizable, FileSetCheck

public abstract class AbstractFileSetCheck
extends AbstractViolationReporter
implements FileSetCheck

Provides common functionality for many FileSetChecks.


Field Summary
private  MessageDispatcher mDispatcher
          The dispatcher errors are fired to.
private  java.lang.String[] mFileExtensions
          the file extensions that are accepted by this filter
private  LocalizedMessages mMessages
          collects the error messages
 
Fields inherited from class com.puppycrawl.tools.checkstyle.api.AbstractViolationReporter
 
Fields inherited from class com.puppycrawl.tools.checkstyle.api.AutomaticBean
 
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 55 .
protected  void log(int aLine, java.lang.String aKey, java.lang.Object[] aArgs)
          Adds a violation message to the message collector 55 .
 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, getMessageBundle, getSeverity, getSeverityLevel, 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
 

Field Detail

mDispatcher

private MessageDispatcher mDispatcher
The dispatcher errors are fired to.


mFileExtensions

private java.lang.String[] mFileExtensions
the file extensions that are accepted by this filter


mMessages

private final LocalizedMessages mMessages
collects the error messages

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

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

getMessageDispatcher

protected final MessageDispatcher getMessageDispatcher()
A message dispatcher is used to fire violation messages to interested audit listeners.


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.


setFileExtensions

public final void setFileExtensions(java.lang.String[] aExtensions)
Sets the file extensions that identify the files that pass the filter of this FileSetCheck.


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.


log

protected final void log(int aLine,
                         java.lang.String aKey,
                         java.lang.Object[] aArgs)
Adds a violation message to the message collector 55 .

Specified by:
log in class AbstractViolationReporter

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

Specified by:
log in class AbstractViolationReporter

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.