com.puppycrawl.tools.checkstyle

Class TreeWalker

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
voiddestroy()
voidfinishLocalSetup()
static DetailASTparse(FileContents aContents)
Static helper method to parses a Java source file.
voidprocess(File[] aFiles)
{@inheritDoc}
voidsetCacheFile(String aFileName)
voidsetClassLoader(ClassLoader aClassLoader)
voidsetModuleFactory(ModuleFactory aModuleFactory)
Sets the module factory for creating child modules (Checks).
voidsetTabWidth(int aTabWidth)
voidsetupChild(Configuration aChildConf)
Instantiates, configures and registers a Check that is specified in the provided configuration.

Constructor Detail

TreeWalker

public TreeWalker()
Creates a new TreeWalker instance.

Method Detail

destroy

public void destroy()

See Also: FileSetCheck

finishLocalSetup

public void finishLocalSetup()

See Also: Configurable

parse

public static DetailAST parse(FileContents aContents)
Static helper method to parses a Java source file.

Parameters: aContents contains the contents of the file

Returns: the root of the AST

Throws: TokenStreamException if lexing failed RecognitionException if parsing failed

process

public void process(File[] aFiles)
{@inheritDoc}

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)
Instantiates, configures and registers a Check that is specified in the provided configuration. {@inheritDoc}