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 aFileSetCheck)
Adds a FileSetCheck to the list of FileSetChecks
that is executed in process().
|
void |
addFilter(Filter aFilter)
Adds a filter to the end of the audit event filter chain.
|
void |
addListener(AuditListener aListener)
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 aFileName,
SortedSet<LocalizedMessage> aErrors)
notify all listeners about the errors in a file.
|
void |
fireFileFinished(String aFileName)
Notify all listeners about the end of a file audit.
|
void |
fireFileStarted(String aFileName)
Notify all listeners about the beginning of a file audit.
|
String |
getBasedir() |
String |
normalize(String aPath)
"normalize" the given absolute path.
|
int |
process(List<File> aFiles)
Processes a set of files with all FileSetChecks.
|
void |
removeFilter(Filter aFilter)
Removes filter.
|
void |
removeListener(AuditListener aListener)
Removes a given listener.
|
void |
setBasedir(String aBasedir) |
void |
setCharset(String aCharset)
Sets a named charset.
|
void |
setClassloader(ClassLoader aLoader)
Sets the classloader that is used to contextualize filesetchecks.
|
void |
setLocaleCountry(String aLocaleCountry) |
void |
setLocaleLanguage(String aLocaleLanguage) |
void |
setModuleClassLoader(ClassLoader aModuleClassLoader)
Sets the classloader used to load Checkstyle core and custom module
classes when the module tree is being built up.
|
void |
setModuleFactory(ModuleFactory aModuleFactory)
Sets the factory for creating submodules.
|
void |
setSeverity(String aSeverity)
Sets the severity level.
|
protected void |
setupChild(Configuration aChildConf)
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 aChildConf) throws CheckstyleException
AutomaticBean
The default implementation does nothing.
setupChild
in class AutomaticBean
aChildConf
- a child of this component's ConfigurationCheckstyleException
- if there is a configuration error.Configuration.getChildren()
public void addFileSetCheck(FileSetCheck aFileSetCheck)
aFileSetCheck
- the additional FileSetCheckpublic void addFilter(Filter aFilter)
aFilter
- the additional filterpublic void removeFilter(Filter aFilter)
aFilter
- filter to remove.public void destroy()
public final void addListener(AuditListener aListener)
aListener
- the nosy thingpublic void removeListener(AuditListener aListener)
aListener
- a listener to removepublic int process(List<File> aFiles)
aFiles
- the list of files to be audited.destroy()
public void setBasedir(String aBasedir)
aBasedir
- the base directory to strip off in filenamespublic String normalize(String aPath)
This includes:
aPath
- 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 aFileName)
fireFileStarted
in interface MessageDispatcher
aFileName
- the file to be auditedpublic void fireFileFinished(String aFileName)
fireFileFinished
in interface MessageDispatcher
aFileName
- the audited filepublic void fireErrors(String aFileName, SortedSet<LocalizedMessage> aErrors)
fireErrors
in interface MessageDispatcher
aFileName
- the audited fileaErrors
- the audit errors from the filepublic void setModuleFactory(ModuleFactory aModuleFactory)
aModuleFactory
- the factory for creating FileSetCheckspublic void setLocaleCountry(String aLocaleCountry)
aLocaleCountry
- the country to report messagespublic void setLocaleLanguage(String aLocaleLanguage)
aLocaleLanguage
- the language to report messagespublic final void setSeverity(String aSeverity)
SeverityLevel
class.aSeverity
- The new severity levelSeverityLevel
public final void setClassloader(ClassLoader aLoader)
aLoader
- the new classloaderpublic final void setModuleClassLoader(ClassLoader aModuleClassLoader)
aModuleClassLoader
- the classloader used to load module classespublic void setCharset(String aCharset) throws UnsupportedEncodingException
aCharset
- the name of a charsetUnsupportedEncodingException
- if aCharset is unsupported.Copyright © 2001-2014. All Rights Reserved.