Class MethodDefHandler
java.lang.Object
com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler
com.puppycrawl.tools.checkstyle.checks.indentation.BlockParentHandler
com.puppycrawl.tools.checkstyle.checks.indentation.MethodDefHandler
Handler for method definitions.
-
Constructor Summary
ConstructorsConstructorDescriptionMethodDefHandler(IndentationCheck indentCheck, DetailAST ast, AbstractExpressionHandler parent) Construct an instance of this handler with the given indentation check, abstract syntax tree, and parent handler. -
Method Summary
Modifier and TypeMethodDescriptionvoidCheck the indentation of the expression we are handling.protected voidCheck the indentation level of modifiers.private voidCheck the indentation level of the throws clause.private static StringgetHandlerName(DetailAST ast) Creates a handler name for this class according to ast type.private static intgetMethodDefLineStart(DetailAST mainAst) Gets the start line of the method, excluding any annotations.private static DetailASTgetMethodDefParamRightParen(DetailAST methodDefAst) Returns right parenthesis of method definition parameter list.protected DetailASTGet the top level expression being managed by this handler.Methods inherited from class com.puppycrawl.tools.checkstyle.checks.indentation.BlockParentHandler
canChildrenBeNested, checkTopLevelToken, curlyIndent, getCheckedChildren, getChildrenExpectedIndent, getLeftCurly, getListChild, getNonListChild, getRightCurly, getSuggestedChildIndentMethods inherited from class com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler
checkChildren, checkExpressionSubtree, checkLeftParen, checkRightParen, checkWrappingIndentation, checkWrappingIndentation, expandedTabsColumnNo, findSubtreeAst, getBasicOffset, getBraceAdjustment, getFirstAstNode, getFirstLine, getFirstToken, getIndent, getIndentCheck, getIndentImpl, getLineStart, getLineStart, getMainAst, getParent, isOnStartOfLine, logError, logError, shouldIncreaseIndent
-
Constructor Details
-
MethodDefHandler
public MethodDefHandler(IndentationCheck indentCheck, DetailAST ast, AbstractExpressionHandler parent) Construct an instance of this handler with the given indentation check, abstract syntax tree, and parent handler.- Parameters:
indentCheck- the indentation checkast- the abstract syntax treeparent- the parent handler
-
-
Method Details
-
getTopLevelAst
Description copied from class:BlockParentHandlerGet the top level expression being managed by this handler.- Overrides:
getTopLevelAstin classBlockParentHandler- Returns:
- the top level expression
-
checkModifiers
Description copied from class:AbstractExpressionHandlerCheck the indentation level of modifiers.- Overrides:
checkModifiersin classAbstractExpressionHandler
-
checkThrows
Check the indentation level of the throws clause. -
getMethodDefLineStart
Gets the start line of the method, excluding any annotations. This is required because the currentTokenTypes.METHOD_DEFmay not always be the start as seen in #3145.- Parameters:
mainAst- The method definition ast.- Returns:
- The start column position of the method.
-
checkIndentation
Description copied from class:AbstractExpressionHandlerCheck the indentation of the expression we are handling.- Overrides:
checkIndentationin classBlockParentHandler
-
getMethodDefParamRightParen
Returns right parenthesis of method definition parameter list.- Parameters:
methodDefAst- method definition ast node(TokenTypes.LITERAL_IF)- Returns:
- right parenthesis of method definition parameter list.
-
getHandlerName
Creates a handler name for this class according to ast type.- Parameters:
ast- the abstract syntax tree.- Returns:
- handler name for this class.
-