## com.puppycrawl.tools.checkstyle.checks.coding
Class AbstractNestedDepthCheck

    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.coding.AbstractNestedDepthCheck

All Implemented Interfaces:
  Configurable, Contextualizable

Direct Known Subclasses:
  NestedIfDepthCheck, NestedTryDepthCheck

    public abstract class AbstractNestedDepthCheck

extends Check

Abstract class which provides helpers functionality for nestedchecks.

Author:
  Simon Harris

Constructor Summary
`AbstractNestedDepthCheck(int aMax)` Creates new instance of checks.

Method Summary
`void` `beginTree(DetailAST aRootAST)` Called before the starting to process a tree.
`int` `getMax()` Getter for maximum allowed nesting depth.
`int[]` `getRequiredTokens()` The tokens that this check must be registered for.
`protected void` `nestIn(DetailAST aAST, String aMessageId)` Increasing current nesting depth.
`protected void` `nestOut()` Decreasing current nesting depth
`void` `setMax(int aMax)` Setter for maximum allowed nesting depth.

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

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

### AbstractNestedDepthCheck

    public AbstractNestedDepthCheck(int aMax)

  Creates new instance of checks.

  Parameters:
    `aMax` - default allowed nesting depth.

Method Detail

### getRequiredTokens

    public final int[] getRequiredTokens()

  The tokens that this check must be registered for.

  Overrides:
    `getRequiredTokens` in class `Check`
  Returns:
    the token set this must be registered for.
  See Also:
    `TokenTypes`

### 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

### getMax

    public final int getMax()

  Getter for maximum allowed nesting depth.

  Returns:
    maximum allowed nesting depth.

### setMax

    public final void setMax(int aMax)

  Setter for maximum allowed nesting depth.

  Parameters:
    `aMax` - maximum allowed nesting depth.

### nestIn

    protected final void nestIn(DetailAST aAST,
                                String aMessageId)

  Increasing current nesting depth.

  Parameters:
    `aAST` - note which increases nesting.
    `aMessageId` - message id for logging error.

### nestOut

    protected final void nestOut()

  Decreasing current nesting depth

Back to the Checkstyle Home Page