Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.puppycrawl.tools.checkstyle
Class TreeWalker

    java.lang.Object
      com.puppycrawl.tools.checkstyle.api.AutomaticBean
          com.puppycrawl.tools.checkstyle.api.AbstractViolationReporter
              com.puppycrawl.tools.checkstyle.api.AbstractFileSetCheck
                  com.puppycrawl.tools.checkstyle.TreeWalker

All 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()` Cleans up the object.
`void` | `finishLocalSetup()` Provides a hook to finish the part of this compoent's setup that was not handled by the bean introspection.
`static DetailAST` | `parse(FileContents aContents)` Static helper method to parses a Java source file.
`void` | `process(java.io.File[] aFiles)` Processes a set of files and fires errors to the MessageDispatcher.
`void` | `setCacheFile(java.lang.String aFileName)`
`void` | `setClassLoader(java.lang.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
`filter, fireErrors, getMessageCollector, getMessageDispatcher, log, log, setFileExtensions, setMessageDispatcher`

Methods inherited from class com.puppycrawl.tools.checkstyle.api.AbstractViolationReporter
`getMessageBundle, getSeverity, getSeverityLevel, log, log, log, log, log, log, log, log, log, setSeverity`

Methods inherited from class com.puppycrawl.tools.checkstyle.api.AutomaticBean
`configure, contextualize, getConfiguration`

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

### TreeWalker

    public TreeWalker()

  Creates a new `TreeWalker` instance.

Method Detail

### setTabWidth

    public void setTabWidth(int aTabWidth)

  Parameters:
    `aTabWidth` - the distance between tab stops

### setCacheFile

    public void setCacheFile(java.lang.String aFileName)

  Parameters:
    `aFileName` - the cache file

### setClassLoader

    public void setClassLoader(java.lang.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

### finishLocalSetup

    public void finishLocalSetup()

  Description copied from class: `AutomaticBean`
  Provides a hook to finish the part of this compoent's setup that was not handled by the bean introspection.

  The default implementation does nothing.

  Overrides:
    `finishLocalSetup` in class `AutomaticBean`
  See Also:
    `Configurable`

### setupChild

    public void setupChild(Configuration aChildConf)
                    throws CheckstyleException

  Instantiates, configures and registers a Check that is specified in the provided configuration.

  Overrides:
    `setupChild` in class `AutomaticBean`
  Parameters:
    `aChildConf` - a child of this component's Configuration
  Throws:
    `CheckstyleException` - if there is a configuration error.
  See Also:
    `AutomaticBean`

### parse

    public static DetailAST parse(FileContents aContents)
                           throws antlr.TokenStreamException,
                                  antlr.RecognitionException

  Static helper method to parses a Java source file.

  Parameters:
    `aContents` - contains the contents of the file
  Returns:
    the root of the AST
  Throws:
    `antlr.TokenStreamException` - if lexing failed
    `antlr.RecognitionException` - if parsing failed

### process

    public void process(java.io.File[] aFiles)

  Description copied from interface: `FileSetCheck`
  Processes a set of files and fires errors to the MessageDispatcher. 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. Once processiong is done, it is highly recommended to call for the destroy method to close and remove the listeners.

  Parameters:
    `aFiles` - the files to be audited.
  See Also:
    `FileSetCheck`

### destroy

    public void destroy()

  Description copied from interface: `FileSetCheck`
  Cleans up the object.

  Specified by:
    `destroy` in interface `FileSetCheck`
  Overrides:
    `destroy` in class `AbstractFileSetCheck`
  See Also:
    `FileSetCheck`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Back to the Checkstyle Home Page
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD