public class Checker extends AutomaticBean implements MessageDispatcher
Constructor and Description |
---|
Checker()
Creates a new
Checker instance. |
Modifier and Type | Method and Description |
---|---|
void |
addFileSetCheck(FileSetCheck fileSetCheck)
Adds a FileSetCheck to the list of FileSetChecks
that is executed in process().
|
void |
addFilter(Filter filter)
Adds a filter to the end of the audit event filter chain.
|
void |
addListener(AuditListener listener)
Add the listener that will be used to receive events from the audit.
|
void |
destroy()
Cleans up the object.
|
void |
finishLocalSetup()
Provides a hook to finish the part of this component's setup that
was not handled by the bean introspection.
|
protected void |
fireAuditFinished()
notify all listeners about the audit end
|
protected void |
fireAuditStarted()
notify all listeners about the audit start
|
void |
fireErrors(String fileName,
SortedSet<LocalizedMessage> errors)
notify all listeners about the errors in a file.
|
void |
fireFileFinished(String fileName)
Notify all listeners about the end of a file audit.
|
void |
fireFileStarted(String fileName)
Notify all listeners about the beginning of a file audit.
|
String |
getBasedir() |
String |
normalize(String normalizingPath)
"normalize" the given absolute path.
|
int |
process(List<File> files)
Processes a set of files with all FileSetChecks.
|
void |
removeFilter(Filter filter)
Removes filter.
|
void |
removeListener(AuditListener listener)
Removes a given listener.
|
void |
setBasedir(String basedir) |
void |
setCharset(String charset)
Sets a named charset.
|
void |
setClassloader(ClassLoader loader)
Sets the classloader that is used to contextualize filesetchecks.
|
void |
setFileExtensions(String[] extensions)
Sets the file extensions that identify the files that pass the
filter of this FileSetCheck.
|
void |
setLocaleCountry(String localeCountry) |
void |
setLocaleLanguage(String localeLanguage) |
void |
setModuleClassLoader(ClassLoader moduleClassLoader)
Sets the classloader used to load Checkstyle core and custom module
classes when the module tree is being built up.
|
void |
setModuleFactory(ModuleFactory moduleFactory)
Sets the factory for creating submodules.
|
void |
setSeverity(String severity)
Sets the severity level.
|
protected void |
setupChild(Configuration childConf)
Called by configure() for every child of this component's Configuration.
|
configure, contextualize, getConfiguration
public Checker() throws CheckstyleException
Checker
instance.
The instance needs to be contextualized and configured.CheckstyleException
- if an error occurspublic void finishLocalSetup() throws CheckstyleException
AutomaticBean
The default implementation does nothing.
finishLocalSetup
in class AutomaticBean
CheckstyleException
- if there is a configuration error.protected void setupChild(Configuration childConf) throws CheckstyleException
AutomaticBean
The default implementation does nothing.
setupChild
in class AutomaticBean
childConf
- a child of this component's ConfigurationCheckstyleException
- if there is a configuration error.Configuration.getChildren()
public void addFileSetCheck(FileSetCheck fileSetCheck)
fileSetCheck
- the additional FileSetCheckpublic void addFilter(Filter filter)
filter
- the additional filterpublic void removeFilter(Filter filter)
filter
- filter to remove.public void destroy()
public final void addListener(AuditListener listener)
listener
- the nosy thingpublic void removeListener(AuditListener listener)
listener
- a listener to removepublic int process(List<File> files)
files
- the list of files to be audited.destroy()
public void setBasedir(String basedir)
basedir
- the base directory to strip off in filenamespublic String normalize(String normalizingPath)
This includes:
normalizingPath
- a path for "normalizing"NullPointerException
- if the file path is
equal to null.public final String getBasedir()
protected void fireAuditStarted()
protected void fireAuditFinished()
public void fireFileStarted(String fileName)
fireFileStarted
in interface MessageDispatcher
fileName
- the file to be auditedpublic void fireFileFinished(String fileName)
fireFileFinished
in interface MessageDispatcher
fileName
- the audited filepublic void fireErrors(String fileName, SortedSet<LocalizedMessage> errors)
fireErrors
in interface MessageDispatcher
fileName
- the audited fileerrors
- the audit errors from the filepublic final void setFileExtensions(String[] extensions)
extensions
- the set of file extensions. A missing
initial '.' character of an extension is automatically added.public void setModuleFactory(ModuleFactory moduleFactory)
moduleFactory
- the factory for creating FileSetCheckspublic void setLocaleCountry(String localeCountry)
localeCountry
- the country to report messagespublic void setLocaleLanguage(String localeLanguage)
localeLanguage
- the language to report messagespublic final void setSeverity(String severity)
SeverityLevel
class.severity
- The new severity levelSeverityLevel
public final void setClassloader(ClassLoader loader)
loader
- the new classloaderpublic final void setModuleClassLoader(ClassLoader moduleClassLoader)
moduleClassLoader
- the classloader used to load module classespublic void setCharset(String charset) throws UnsupportedEncodingException
charset
- the name of a charsetUnsupportedEncodingException
- if charset is unsupported.Copyright © 2001–2015. All rights reserved.