Class StatementReplacingVisitorSupport

  • All Implemented Interfaces:
    org.codehaus.groovy.ast.GroovyClassVisitor, org.codehaus.groovy.ast.GroovyCodeVisitor
    Direct Known Subclasses:
    AbstractDeepBlockRewriter, ExpressionReplacingVisitorSupport

    public abstract class StatementReplacingVisitorSupport
    extends org.codehaus.groovy.ast.ClassCodeVisitorSupport
    Adds the ability to replace statements.
    Author:
    Peter Niederwieser
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected org.codehaus.groovy.control.SourceUnit getSourceUnit()  
      org.codehaus.groovy.ast.stmt.Statement replace​(org.codehaus.groovy.ast.stmt.Statement stat)
      Visits the specified statement.
      protected <T extends org.codehaus.groovy.ast.stmt.Statement>
      void
      replaceAll​(java.util.List<T> stats)
      Visits the statements in the specified mutable list.
      protected void replaceVisitedStatementWith​(org.codehaus.groovy.ast.stmt.Statement other)
      Replaces the currently visited statement with the specified statement.
      void visitBlockStatement​(org.codehaus.groovy.ast.stmt.BlockStatement stat)  
      void visitCaseStatement​(org.codehaus.groovy.ast.stmt.CaseStatement stat)  
      void visitCatchStatement​(org.codehaus.groovy.ast.stmt.CatchStatement stat)  
      void visitDoWhileLoop​(org.codehaus.groovy.ast.stmt.DoWhileStatement stat)  
      void visitForLoop​(org.codehaus.groovy.ast.stmt.ForStatement stat)  
      void visitIfElse​(org.codehaus.groovy.ast.stmt.IfStatement stat)  
      void visitSwitch​(org.codehaus.groovy.ast.stmt.SwitchStatement stat)  
      void visitSynchronizedStatement​(org.codehaus.groovy.ast.stmt.SynchronizedStatement stat)  
      void visitTryCatchFinally​(org.codehaus.groovy.ast.stmt.TryCatchStatement stat)  
      void visitWhileLoop​(org.codehaus.groovy.ast.stmt.WhileStatement stat)  
      • Methods inherited from class org.codehaus.groovy.ast.ClassCodeVisitorSupport

        addError, visitAnnotations, visitAssertStatement, visitBreakStatement, visitClass, visitClassCodeContainer, visitConstructor, visitConstructorOrMethod, visitContinueStatement, visitDeclarationExpression, visitExpressionStatement, visitField, visitImports, visitMethod, visitObjectInitializerStatements, visitPackage, visitProperty, visitReturnStatement, visitStatement, visitThrowStatement
      • Methods inherited from class org.codehaus.groovy.ast.CodeVisitorSupport

        visitArgumentlistExpression, visitArrayExpression, visitAttributeExpression, visitBinaryExpression, visitBitwiseNegationExpression, visitBooleanExpression, visitBytecodeExpression, visitCastExpression, visitClassExpression, visitClosureExpression, visitClosureListExpression, visitConstantExpression, visitConstructorCallExpression, visitEmptyStatement, visitFieldExpression, visitGStringExpression, visitListExpression, visitListOfExpressions, visitMapEntryExpression, visitMapExpression, visitMethodCallExpression, visitMethodPointerExpression, visitNotExpression, visitPostfixExpression, visitPrefixExpression, visitPropertyExpression, visitRangeExpression, visitShortTernaryExpression, visitSpreadExpression, visitSpreadMapExpression, visitStaticMethodCallExpression, visitTernaryExpression, visitTupleExpression, visitUnaryMinusExpression, visitUnaryPlusExpression, visitVariableExpression
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • StatementReplacingVisitorSupport

        public StatementReplacingVisitorSupport()
    • Method Detail

      • replace

        public org.codehaus.groovy.ast.stmt.Statement replace​(org.codehaus.groovy.ast.stmt.Statement stat)
        Visits the specified statement. If the statement's visit method calls replaceVisitedMethodWith(), the statement will be replaced.
      • replaceAll

        protected <T extends org.codehaus.groovy.ast.stmt.Statement> void replaceAll​(java.util.List<T> stats)
        Visits the statements in the specified mutable list. If a statement's visit method calls replaceVisitedMethodWith(), the statement will be replaced.
      • replaceVisitedStatementWith

        protected void replaceVisitedStatementWith​(org.codehaus.groovy.ast.stmt.Statement other)
        Replaces the currently visited statement with the specified statement.
      • visitBlockStatement

        public void visitBlockStatement​(org.codehaus.groovy.ast.stmt.BlockStatement stat)
        Specified by:
        visitBlockStatement in interface org.codehaus.groovy.ast.GroovyCodeVisitor
        Overrides:
        visitBlockStatement in class org.codehaus.groovy.ast.ClassCodeVisitorSupport
      • visitForLoop

        public void visitForLoop​(org.codehaus.groovy.ast.stmt.ForStatement stat)
        Specified by:
        visitForLoop in interface org.codehaus.groovy.ast.GroovyCodeVisitor
        Overrides:
        visitForLoop in class org.codehaus.groovy.ast.ClassCodeVisitorSupport
      • visitWhileLoop

        public void visitWhileLoop​(org.codehaus.groovy.ast.stmt.WhileStatement stat)
        Specified by:
        visitWhileLoop in interface org.codehaus.groovy.ast.GroovyCodeVisitor
        Overrides:
        visitWhileLoop in class org.codehaus.groovy.ast.ClassCodeVisitorSupport
      • visitDoWhileLoop

        public void visitDoWhileLoop​(org.codehaus.groovy.ast.stmt.DoWhileStatement stat)
        Specified by:
        visitDoWhileLoop in interface org.codehaus.groovy.ast.GroovyCodeVisitor
        Overrides:
        visitDoWhileLoop in class org.codehaus.groovy.ast.ClassCodeVisitorSupport
      • visitIfElse

        public void visitIfElse​(org.codehaus.groovy.ast.stmt.IfStatement stat)
        Specified by:
        visitIfElse in interface org.codehaus.groovy.ast.GroovyCodeVisitor
        Overrides:
        visitIfElse in class org.codehaus.groovy.ast.ClassCodeVisitorSupport
      • visitTryCatchFinally

        public void visitTryCatchFinally​(org.codehaus.groovy.ast.stmt.TryCatchStatement stat)
        Specified by:
        visitTryCatchFinally in interface org.codehaus.groovy.ast.GroovyCodeVisitor
        Overrides:
        visitTryCatchFinally in class org.codehaus.groovy.ast.ClassCodeVisitorSupport
      • visitSwitch

        public void visitSwitch​(org.codehaus.groovy.ast.stmt.SwitchStatement stat)
        Specified by:
        visitSwitch in interface org.codehaus.groovy.ast.GroovyCodeVisitor
        Overrides:
        visitSwitch in class org.codehaus.groovy.ast.ClassCodeVisitorSupport
      • visitCaseStatement

        public void visitCaseStatement​(org.codehaus.groovy.ast.stmt.CaseStatement stat)
        Specified by:
        visitCaseStatement in interface org.codehaus.groovy.ast.GroovyCodeVisitor
        Overrides:
        visitCaseStatement in class org.codehaus.groovy.ast.ClassCodeVisitorSupport
      • visitSynchronizedStatement

        public void visitSynchronizedStatement​(org.codehaus.groovy.ast.stmt.SynchronizedStatement stat)
        Specified by:
        visitSynchronizedStatement in interface org.codehaus.groovy.ast.GroovyCodeVisitor
        Overrides:
        visitSynchronizedStatement in class org.codehaus.groovy.ast.ClassCodeVisitorSupport
      • visitCatchStatement

        public void visitCatchStatement​(org.codehaus.groovy.ast.stmt.CatchStatement stat)
        Specified by:
        visitCatchStatement in interface org.codehaus.groovy.ast.GroovyCodeVisitor
        Overrides:
        visitCatchStatement in class org.codehaus.groovy.ast.ClassCodeVisitorSupport
      • getSourceUnit

        protected org.codehaus.groovy.control.SourceUnit getSourceUnit()
        Specified by:
        getSourceUnit in class org.codehaus.groovy.ast.ClassCodeVisitorSupport