com.puppycrawl.tools.checkstyle

Class TreeWalker

Implemented Interfaces:
Configurable, Contextualizable, FileSetCheck

public final class TreeWalker
extends AbstractFileSetCheck

Responsible for walking an abstract syntax tree and notifying interested checks at each each node.
Version:
1.0
Author:
Oliver Burn

Constructor Summary

TreeWalker()
Creates a new TreeWalker instance.

Method Summary

void
destroy()
void
finishLocalSetup()
static DetailAST
parse(FileContents aContents)
Static helper method to parses a Java source file.
void
process(File[] aFiles)
void
setCacheFile(String aFileName)
void
setClassLoader(ClassLoader aClassLoader)
void
setModuleFactory(ModuleFactory aModuleFactory)
Sets the module factory for creating child modules (Checks).
void
setTabWidth(int aTabWidth)
void
setupChild(Configuration aChildConf)
Instantiates, configures and registers a Check that is specified in the provided configuration.

Methods inherited from class com.puppycrawl.tools.checkstyle.api.AbstractFileSetCheck

destroy, filter, fireErrors, getCharset, getMessageCollector, getMessageDispatcher, log, log, setCharset, setFileExtensions, setMessageDispatcher

Methods inherited from class com.puppycrawl.tools.checkstyle.api.AbstractViolationReporter

getMessageBundle, getSeverity, getSeverityLevel, log, log, log, log, log, log, log, log, log, log, log, setSeverity

Methods inherited from class com.puppycrawl.tools.checkstyle.api.AutomaticBean

configure, contextualize, finishLocalSetup, getConfiguration, setupChild

Constructor Details

TreeWalker

public TreeWalker()
Creates a new TreeWalker instance.

Method Details

destroy

public void destroy()
Specified by:
destroy in interface FileSetCheck
Overrides:
destroy in interface AbstractFileSetCheck
See Also:
FileSetCheck

finishLocalSetup

public void finishLocalSetup()
Overrides:
finishLocalSetup in interface AutomaticBean
See Also:
Configurable

parse

public static DetailAST parse(FileContents aContents)
            throws RecognitionException,
                   TokenStreamException
Static helper method to parses a Java source file.
Parameters:
aContents - contains the contents of the file
Returns:
the root of the AST

process

public void process(File[] aFiles)
Specified by:
process in interface FileSetCheck

setCacheFile

public void setCacheFile(String aFileName)
Parameters:
aFileName - the cache file

setClassLoader

public void setClassLoader(ClassLoader aClassLoader)
Parameters:
aClassLoader - class loader to resolve classes with.

setModuleFactory

public void setModuleFactory(ModuleFactory aModuleFactory)
Sets the module factory for creating child modules (Checks).
Parameters:
aModuleFactory - the factory

setTabWidth

public void setTabWidth(int aTabWidth)
Parameters:
aTabWidth - the distance between tab stops

setupChild

public void setupChild(Configuration aChildConf)
            throws CheckstyleException
Instantiates, configures and registers a Check that is specified in the provided configuration.
Overrides:
setupChild in interface AutomaticBean