com.puppycrawl.tools.checkstyle.checks.coding

Class AbstractNestedDepthCheck

Implemented Interfaces:
Configurable, Contextualizable
Known Direct 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)
int
getMax()
Getter for maximum allowed nesting depth.
int[]
getRequiredTokens()
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

beginTree, destroy, finishTree, getAcceptableTokens, getClassLoader, getDefaultTokens, getFileContents, getLines, getRequiredTokens, getTabWidth, getTokenNames, init, leaveToken, log, log, setClassLoader, setFileContents, setMessages, setTabWidth, setTokens, visitToken

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

AbstractNestedDepthCheck

public AbstractNestedDepthCheck(int aMax)
Creates new instance of checks.

Parameters:
aMax - default allowed nesting depth.

Method Details

beginTree

public void beginTree(DetailAST aRootAST)
Overrides:
beginTree in interface Check

See Also:
Check


getMax

public final int getMax()
Getter for maximum allowed nesting depth.

Returns:
maximum allowed nesting depth.


getRequiredTokens

public final int[] getRequiredTokens()
Overrides:
getRequiredTokens in interface Check

See Also:
Check


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


setMax

public final void setMax(int aMax)
Setter for maximum allowed nesting depth.

Parameters:
aMax - maximum allowed nesting depth.