com.puppycrawl.tools.checkstyle.api
Class AbstractFileSetCheck
- Configurable, Contextualizable, FileSetCheck
public abstract class AbstractFileSetCheck
Provides common functionality for many FileSetChecks.
getMessageBundle , getSeverity , getSeverityLevel , log , log , log , log , log , log , log , log , log , log , log , setSeverity |
filter
protected final File[] filter(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.
aFiles
- the candidates for processing
- the subset of aFiles that this FileSetCheck should process
fireErrors
protected final void fireErrors(String aFileName)
Notify all listeners about the errors in a file.
Calls MessageDispatcher.fireErrors()
with
all logged errors and than clears errors' list.
aFileName
- the audited file
getCharset
public String getCharset()
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.
- the collector for localized messages.
getMessageDispatcher
protected final MessageDispatcher getMessageDispatcher()
A message dispatcher is used to fire violation messages to
interested audit listeners.
- the current MessageDispatcher.
setCharset
public void setCharset(String aCharset)
throws UnsupportedEncodingException
Sets a named charset.
aCharset
- the name of a charset
setFileExtensions
public final void setFileExtensions(String[] aExtensions)
Sets the file extensions that identify the files that pass the
filter of this FileSetCheck.
aExtensions
- the set of file extensions. A missing
initial '.' character of an extension is automatically added.