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.checks
Class DeclarationCollector

    java.lang.Object
      com.puppycrawl.tools.checkstyle.api.AutomaticBean
          com.puppycrawl.tools.checkstyle.api.AbstractViolationReporter
              com.puppycrawl.tools.checkstyle.api.Check
                  com.puppycrawl.tools.checkstyle.checks.DeclarationCollector

All Implemented Interfaces:
  Configurable, Contextualizable

Direct Known Subclasses:
  RequireThisCheck, UnusedImportsCheck

    public abstract class DeclarationCollector

extends Check

Abstract class for chekcs which need to collect information about declared members/parameters/variables.

Author:
  o_sukhodolsky

Constructor Summary
`DeclarationCollector()`

Method Summary
`void` | `beginTree(DetailAST aRootAST)` Called before the starting to process a tree.
`protected boolean` | `isClassField(String aName)` Check if given name is a name for class field in current environment.
`protected boolean` | `isDeclared(String aName)` Check if given name is a name for declafred variable/parameter/member in current environment.
`void` | `leaveToken(DetailAST aAST)` Called after all the child nodes have been process.
`void` | `visitToken(DetailAST aAST)` Called to process a token.

Methods inherited from class com.puppycrawl.tools.checkstyle.api.Check
`destroy, finishTree, getAcceptableTokens, getClassLoader, getDefaultTokens, getFileContents, getLines, getRequiredTokens, getTabWidth, getTokenNames, init, log, log, setClassLoader, setFileContents, setMessages, setTabWidth, setTokens`

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

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

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### DeclarationCollector

    public DeclarationCollector()

Method Detail

### beginTree

    public void beginTree(DetailAST aRootAST)

  Called before the starting to process a tree. Ideal place to initialise information that is to be collected whilst processing a tree.

  Overrides:
    `beginTree` in class `Check`
  Parameters:
    `aRootAST` - the root of the tree

### visitToken

    public void visitToken(DetailAST aAST)

  Called to process a token.

  Overrides:
    `visitToken` in class `Check`
  Parameters:
    `aAST` - the token to process

### leaveToken

    public void leaveToken(DetailAST aAST)

  Called after all the child nodes have been process.

  Overrides:
    `leaveToken` in class `Check`
  Parameters:
    `aAST` - the token leaving

### isDeclared

    protected final boolean isDeclared(String aName)

  Check if given name is a name for declafred variable/parameter/member in current environment.

  Parameters:
    `aName` - a name to check
  Returns:
    true is the given name is declare one.

### isClassField

    protected final boolean isClassField(String aName)

  Check if given name is a name for class field in current environment.

  Parameters:
    `aName` - a name to check
  Returns:
    true is the given name is name of method or member.

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