|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.puppycrawl.tools.checkstyle.api.AutomaticBean com.puppycrawl.tools.checkstyle.api.AbstractViolationReporter com.puppycrawl.tools.checkstyle.api.AbstractFileSetCheck
public abstract class AbstractFileSetCheck
Provides common functionality for many FileSetChecks.
Constructor Summary | |
---|---|
AbstractFileSetCheck()
|
Method Summary | |
---|---|
void |
beginProcessing(String aCharset)
Called when about to be called to process a set of files. |
void |
destroy()
Cleans up the object. |
void |
finishProcessing()
Called when all the files have been processed. |
protected void |
fireErrors(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. |
void |
init()
Initialise the instance. |
void |
log(int aLineNo,
int aColNo,
String aKey,
Object... aArgs)
Log a message that has column information. |
void |
log(int aLine,
String aKey,
Object... aArgs)
Log a message that has no column information. |
TreeSet<LocalizedMessage> |
process(File aFile,
List<String> aLines)
Request to process a file. |
protected abstract void |
processFiltered(File aFile,
List<String> aLines)
Called to process a file that matches the specified file extensions. |
void |
setFileExtensions(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 |
---|
getCustomMessages, getId, getMessageBundle, getSeverity, getSeverityLevel, log, setId, 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.Configurable |
---|
configure |
Methods inherited from interface com.puppycrawl.tools.checkstyle.api.Contextualizable |
---|
contextualize |
Constructor Detail |
---|
public AbstractFileSetCheck()
Method Detail |
---|
protected abstract void processFiltered(File aFile, List<String> aLines)
aFile
- the file to be processedaLines
- an immutable list of the contents of the file.public void init()
init
in interface FileSetCheck
public void destroy()
destroy
in interface FileSetCheck
public void beginProcessing(String aCharset)
beginProcessing
in interface FileSetCheck
aCharset
- the character set used to read the files.public final TreeSet<LocalizedMessage> process(File aFile, List<String> aLines)
The file set to process might contain files that are not interesting to the FileSetCheck. Such files should be ignored, no error message should be fired for them. For example a FileSetCheck that checks java files should ignore HTML or properties files.
The method should return the set of messages to be logged.
process
in interface FileSetCheck
aFile
- the file to be processedaLines
- an immutable list of the contents of the file.
public void finishProcessing()
finishProcessing
in interface FileSetCheck
public final void setMessageDispatcher(MessageDispatcher aDispatcher)
setMessageDispatcher
in interface FileSetCheck
aDispatcher
- the dispatcherprotected final MessageDispatcher getMessageDispatcher()
public final void setFileExtensions(String[] aExtensions)
aExtensions
- the set of file extensions. A missing
initial '.' character of an extension is automatically added.protected final LocalizedMessages getMessageCollector()
public final void log(int aLine, String aKey, Object... aArgs)
AbstractViolationReporter
log
in class AbstractViolationReporter
aLine
- the line number where the error was foundaKey
- the message that describes the erroraArgs
- the details of the messageMessageFormat
public final void log(int aLineNo, int aColNo, String aKey, Object... aArgs)
AbstractViolationReporter
log
in class AbstractViolationReporter
aLineNo
- the line number where the error was foundaColNo
- the column number where the error was foundaKey
- the message that describes the erroraArgs
- the details of the messageMessageFormat
protected final void fireErrors(String aFileName)
MessageDispatcher.fireErrors()
with
all logged errors and than clears errors' list.
aFileName
- the audited file
|
Back to the Checkstyle Home Page | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |