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
- public abstract class AbstractFileSetCheck
- extends AbstractViolationReporter
- implements FileSetCheck
Provides common functionality for many FileSetChecks.
| Fields inherited from class com.puppycrawl.tools.checkstyle.api.AutomaticBean |
|
| 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 java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
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
AbstractFileSetCheck
public AbstractFileSetCheck()
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.