[Java] Class MethodInvocationTrap
- org.codehaus.groovy.ast.MethodInvocationTrap
public abstract class MethodInvocationTrap extends CodeVisitorSupport
Field Summary
Modifiers | Name | Description |
---|---|---|
protected ReaderSource | source | |
protected SourceUnit | sourceUnit |
Constructor Summary
Constructor and description |
---|
MethodInvocationTrap
(ReaderSource source, SourceUnit sourceUnit) |
Methods Summary
Type Params | Return Type | Name and description |
---|---|---|
protected void |
addError(String msg, ASTNode expr) Reports an error back to the source unit. | |
protected String |
convertClosureToSource(ClosureExpression expression) Converts a ClosureExpression into the String source. | |
protected abstract boolean |
handleTargetMethodCallExpression(MethodCallExpression call) | |
protected abstract boolean |
isBuildInvocation(MethodCallExpression call) | |
public void |
visitMethodCallExpression(MethodCallExpression call) Attempts to find AstBuilder 'from code' invocations. |
Inherited Methods Summary
Field Detail
protected final ReaderSource source
protected final SourceUnit sourceUnit
Constructor Detail
public MethodInvocationTrap(ReaderSource source, SourceUnit sourceUnit)
Method Detail
protected void addError(String msg, ASTNode expr)
Reports an error back to the source unit.
- Parameters:
-
msg
- the error message -
expr
- the expression that caused the error message.
protected String convertClosureToSource(ClosureExpression expression)
Converts a ClosureExpression into the String source.
- Parameters:
-
expression
- a closure
- Returns:
- the source the closure was created from
protected abstract boolean handleTargetMethodCallExpression(MethodCallExpression call)
protected abstract boolean isBuildInvocation(MethodCallExpression call)
public void visitMethodCallExpression(MethodCallExpression call)
Attempts to find AstBuilder 'from code' invocations. When found, converts them into calls to the 'from string' approach.
- Parameters:
-
call
- the method call expression that may or may not be an AstBuilder 'from code' invocation.
© 2003-2020 The Apache Software Foundation
Licensed under the Apache license.
https://docs.groovy-lang.org/3.0.7/html/gapi/org/codehaus/groovy/ast/MethodInvocationTrap.html