Class MethodInvocationTrap

java.lang.Object
org.codehaus.groovy.ast.CodeVisitorSupport
org.codehaus.groovy.ast.MethodInvocationTrap
All Implemented Interfaces:
GroovyCodeVisitor

public abstract class MethodInvocationTrap
extends CodeVisitorSupport
  • Field Details

  • Constructor Details

  • Method Details

    • visitMethodCallExpression

      public void visitMethodCallExpression​(MethodCallExpression call)
      Attempts to find AstBuilder 'from code' invocations. When found, converts them into calls to the 'from string' approach.
      Specified by:
      visitMethodCallExpression in interface GroovyCodeVisitor
      Overrides:
      visitMethodCallExpression in class CodeVisitorSupport
      Parameters:
      call - the method call expression that may or may not be an AstBuilder 'from code' invocation.
    • addError

      protected void addError​(java.lang.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.
    • convertClosureToSource

      protected java.lang.String convertClosureToSource​(ClosureExpression expression)
      Converts a ClosureExpression into the String source.
      Parameters:
      expression - a closure
      Returns:
      the source the closure was created from
    • handleTargetMethodCallExpression

      protected abstract boolean handleTargetMethodCallExpression​(MethodCallExpression call)
    • isBuildInvocation

      protected abstract boolean isBuildInvocation​(MethodCallExpression call)