public abstract class AbstractMethodCallCheck extends AbstractAddonsCheck
Constructor and Description |
---|
AbstractMethodCallCheck() |
Modifier and Type | Method and Description |
---|---|
void |
beginTree(com.puppycrawl.tools.checkstyle.api.DetailAST pRootAst) |
java.lang.String |
getCurrentMethodName()
The current method name.
|
java.util.Set<java.lang.Integer> |
getRelevantTokens()
The tokens which this check is interested in.
|
protected abstract boolean |
isCheckActive()
Determines if the check is configured to do anything at all.
|
protected abstract boolean |
isRelevantCall(java.lang.String pQualifier,
java.lang.String pMethodName)
Filter method which determines if the given method call is considered relevant.
|
protected void |
leaveToken(BinaryName pBinaryClassName,
com.puppycrawl.tools.checkstyle.api.DetailAST pAst)
Called after all the child nodes have been processed.
|
protected abstract void |
visitMethodCall(java.lang.String pMethodName,
com.puppycrawl.tools.checkstyle.api.DetailAST pMethodCallAst)
Visitor method called when a relevant method call is encountered.
|
protected void |
visitToken(BinaryName pBinaryClassName,
com.puppycrawl.tools.checkstyle.api.DetailAST pAst)
Called to process a token.
|
finishTree, finishTree, getAcceptableTokens, getApiFixer, getClassDeclarationPosition, getCurrentBinaryName, getCurrentSimpleName, getDefaultTokens, getMyPackage, getRequiredTokens, leaveKnownType, leaveToken, visitKnownType, visitToken
clearMessages, destroy, getClassLoader, getFileContents, getLine, getLines, getMessages, getTabWidth, getTokenNames, init, isCommentNodesRequired, log, log, log, setClassLoader, setFileContents, setTabWidth, setTokens
finishLocalSetup, getCustomMessages, getId, getMessageBundle, getSeverity, getSeverityLevel, setId, setSeverity
public void beginTree(com.puppycrawl.tools.checkstyle.api.DetailAST pRootAst)
beginTree
in class AbstractAddonsCheck
@CheckForNull public java.lang.String getCurrentMethodName()
"<init>"
is used for constructors and instance initializers, and
"<clinit>"
is used for static initializers.null
if we are not inside a method, constructor, or initializerpublic java.util.Set<java.lang.Integer> getRelevantTokens()
AbstractAddonsCheck
getRelevantTokens
in class AbstractAddonsCheck
protected abstract boolean isCheckActive()
true
if processing should be performedprotected abstract boolean isRelevantCall(@Nullable java.lang.String pQualifier, @Nonnull java.lang.String pMethodName)
pQualifier
- the qualifier of the method call (for a call like Foo.Bar.call()
, the
qualifier is Foo.Bar
)pMethodName
- the simple name of the called methodtrue
) or not (false
)protected void leaveToken(@Nullable BinaryName pBinaryClassName, @Nonnull com.puppycrawl.tools.checkstyle.api.DetailAST pAst)
AbstractAddonsCheck
leaveToken
in class AbstractAddonsCheck
pBinaryClassName
- the currently active binary class namepAst
- the token being completedprotected abstract void visitMethodCall(@Nonnull java.lang.String pMethodName, @Nonnull com.puppycrawl.tools.checkstyle.api.DetailAST pMethodCallAst)
pMethodName
- the simple name of the called methodpMethodCallAst
- AST of the call, useful for logging issues ( this is a METHOD_DEF, CTOR_CALL, or a
SUPER_CTOR_CALL token)protected void visitToken(@Nullable BinaryName pBinaryClassName, @Nonnull com.puppycrawl.tools.checkstyle.api.DetailAST pAst)
AbstractAddonsCheck
visitToken
in class AbstractAddonsCheck
pBinaryClassName
- the currently active binary class namepAst
- the token to process