com.puppycrawl.tools.checkstyle.checks.indentation

Class ArrayInitHandler


public class ArrayInitHandler
extends BlockParentHandler

Handler for array initialization blocks.

Author:
jrichard

Constructor Summary

ArrayInitHandler(IndentationCheck aIndentCheck, DetailAST aAst, ExpressionHandler aParent)
Construct an instance of this handler with the given indentation check, abstract syntax tree, and parent handler.

Method Summary

protected boolean
childrenMayNest()
Determines if child elements within the expression may be nested.
protected IndentLevel
getChildrenExpectedLevel()
protected DetailAST
getLCurly()
Get the left curly brace portion of the expression we are handling.
IndentLevel
getLevelImpl()
Compute the indentation amount for this handler.
protected DetailAST
getListChild()
Get the child element representing the list of statements.
protected DetailAST
getRCurly()
Get the right curly brace portion of the expression we are handling.
protected DetailAST
getToplevelAST()
There is no top level expression for this handler.
protected boolean
rcurlyMustStart()
Determines if the right curly brace must be at the start of the line.

Methods inherited from class com.puppycrawl.tools.checkstyle.checks.indentation.BlockParentHandler

checkIndentation, checkLCurly, checkLParen, checkRCurly, checkRParen, checkToplevelToken, childrenMayNest, getChildrenExpectedLevel, getLCurly, getLParen, getListChild, getNonlistChild, getRCurly, getRParen, getToplevelAST, hasCurlys, rcurlyMustStart, toplevelMustStartLine

Methods inherited from class com.puppycrawl.tools.checkstyle.checks.indentation.ExpressionHandler

checkChildren, checkExpressionSubtree, checkIndentation, checkLinesIndent, checkModifiers, expandedTabsColumnNo, findSubtreeLines, getBasicOffset, getBraceAdjustement, getFirstLine, getIndentCheck, getLevel, getLevelImpl, getLineStart, getLineStart, getMainAst, getParent, logError, logError, shouldIncreaseIndent, startsLine, suggestedChildLevel

Constructor Details

ArrayInitHandler

public ArrayInitHandler(IndentationCheck aIndentCheck,
                        DetailAST aAst,
                        ExpressionHandler aParent)
Construct an instance of this handler with the given indentation check, abstract syntax tree, and parent handler.

Parameters:
aIndentCheck - the indentation check
aAst - the abstract syntax tree
aParent - the parent handler

Method Details

childrenMayNest

protected boolean childrenMayNest()
Determines if child elements within the expression may be nested.
Overrides:
childrenMayNest in interface BlockParentHandler

Returns:
true


getChildrenExpectedLevel

protected IndentLevel getChildrenExpectedLevel()
Overrides:
getChildrenExpectedLevel in interface BlockParentHandler

See Also:
BlockParentHandler


getLCurly

protected DetailAST getLCurly()
Get the left curly brace portion of the expression we are handling.
Overrides:
getLCurly in interface BlockParentHandler

Returns:
the left curly brace expression


getLevelImpl

public IndentLevel getLevelImpl()
Compute the indentation amount for this handler.
Overrides:
getLevelImpl in interface ExpressionHandler

Returns:
the expected indentation amount


getListChild

protected DetailAST getListChild()
Get the child element representing the list of statements.
Overrides:
getListChild in interface BlockParentHandler

Returns:
the statement list child


getRCurly

protected DetailAST getRCurly()
Get the right curly brace portion of the expression we are handling.
Overrides:
getRCurly in interface BlockParentHandler

Returns:
the right curly brace expression


getToplevelAST

protected DetailAST getToplevelAST()
There is no top level expression for this handler.
Overrides:
getToplevelAST in interface BlockParentHandler

Returns:
null


rcurlyMustStart

protected boolean rcurlyMustStart()
Determines if the right curly brace must be at the start of the line.
Overrides:
rcurlyMustStart in interface BlockParentHandler

Returns:
false