public class MethodCallHandler extends AbstractExpressionHandler
| Modifier and Type | Field and Description |
|---|---|
private IndentationCheck |
indentCheck
The instance of
IndentationCheck used by this class. |
| Constructor and Description |
|---|
MethodCallHandler(IndentationCheck indentCheck,
DetailAST ast,
AbstractExpressionHandler parent)
Construct an instance of this handler with the given indentation check,
abstract syntax tree, and parent handler.
|
| Modifier and Type | Method and Description |
|---|---|
private static boolean |
areMethodsChained(DetailAST ast1,
DetailAST ast2)
Checks if ast2 is a chained method call that starts on the same level as ast1 ends.
|
void |
checkIndentation()
Check the indentation of the expression we are handling.
|
private static DetailAST |
getCallLastNode(DetailAST firstNode)
Returns method or constructor call right paren.
|
private static DetailAST |
getFirstAst(DetailAST ast)
Get the first AST of the specified method call.
|
protected IndentLevel |
getIndentImpl()
Compute the indentation amount for this handler.
|
private DetailAST |
getMethodIdentAst()
Returns method or constructor name.
|
IndentLevel |
getSuggestedChildIndent(AbstractExpressionHandler child)
Indentation level suggested for a child element.
|
private boolean |
isChainedMethodCallWrapped()
If this is the first chained method call which was moved to the next line.
|
protected boolean |
shouldIncreaseIndent()
Checks that indentation should be increased after first line in checkLinesIndent().
|
checkChildren, checkExpressionSubtree, checkLeftParen, checkModifiers, checkRightParen, checkWrappingIndentation, checkWrappingIndentation, expandedTabsColumnNo, findSubtreeAst, getBasicOffset, getBraceAdjustment, getFirstAstNode, getFirstLine, getFirstToken, getIndent, getIndentCheck, getLineStart, getLineStart, getMainAst, getParent, isOnStartOfLine, logError, logErrorprivate final IndentationCheck indentCheck
IndentationCheck used by this class.public MethodCallHandler(IndentationCheck indentCheck, DetailAST ast, AbstractExpressionHandler parent)
indentCheck - the indentation checkast - the abstract syntax treeparent - the parent handlerprotected IndentLevel getIndentImpl()
AbstractExpressionHandlergetIndentImpl in class AbstractExpressionHandlerprivate static boolean areMethodsChained(DetailAST ast1, DetailAST ast2)
value.methodOne(
argument1
).methodTwo(
argument2
);
ast1 - Ast1ast2 - Ast2private boolean isChainedMethodCallWrapped()
private static DetailAST getFirstAst(DetailAST ast)
ast - the method callprivate DetailAST getMethodIdentAst()
foo(arg) it is `foo`, for
foo.bar(arg) it is `bar` for super(arg) it is 'super'.public IndentLevel getSuggestedChildIndent(AbstractExpressionHandler child)
AbstractExpressionHandlergetSuggestedChildIndent in class AbstractExpressionHandlerchild - child AST (so suggestion level can differ based on child
type)public void checkIndentation()
AbstractExpressionHandlercheckIndentation in class AbstractExpressionHandlerprotected boolean shouldIncreaseIndent()
AbstractExpressionHandlershouldIncreaseIndent in class AbstractExpressionHandlerprivate static DetailAST getCallLastNode(DetailAST firstNode)
firstNode - call ast(TokenTypes.METHOD_CALL|TokenTypes.CTOR_CALL|TokenTypes.SUPER_CTOR_CALL)Copyright © 2001-2022. All Rights Reserved.