org.codehaus.groovy.transform.powerassert

## Class StatementReplacingVisitorSupport

- java.lang.Object
- - org.codehaus.groovy.ast.CodeVisitorSupport
  - - org.codehaus.groovy.ast.ClassCodeVisitorSupport
    - - org.codehaus.groovy.transform.powerassert.StatementReplacingVisitorSupport

- All Implemented Interfaces:
    GroovyClassVisitor, GroovyCodeVisitor
  Direct Known Subclasses:
    AssertionRewriter

      public abstract class StatementReplacingVisitorSupport
      extends ClassCodeVisitorSupport

  Adds the ability to replace statements.
  Author:
    Peter Niederwieser

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `StatementReplacingVisitorSupport()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `Statement` | `replace(Statement stat)` Visits the specified statement.
    `protected <T extends Statement> void` | `replaceAll(List<T> stats)` Visits the statements in the specified mutable list.
    `protected void` | `replaceVisitedStatementWith(Statement other)` Replaces the currently visited statement with the specified statement.
    `void` | `visitBlockStatement(BlockStatement stat)`
    `void` | `visitCaseStatement(CaseStatement stat)`
    `void` | `visitCatchStatement(CatchStatement stat)`
    `void` | `visitDoWhileLoop(DoWhileStatement stat)`
    `void` | `visitForLoop(ForStatement stat)`
    `void` | `visitIfElse(IfStatement stat)`
    `void` | `visitSwitch(SwitchStatement stat)`
    `void` | `visitSynchronizedStatement(SynchronizedStatement stat)`
    `void` | `visitTryCatchFinally(TryCatchStatement stat)`
    `void` | `visitWhileLoop(WhileStatement stat)`

    - ### Methods inherited from class org.codehaus.groovy.ast.ClassCodeVisitorSupport

      `addError, getSourceUnit, visitAnnotations, visitAssertStatement, visitBreakStatement, visitClass, visitClassCodeContainer, visitConstructor, visitConstructorOrMethod, visitContinueStatement, visitExpressionStatement, visitField, visitImports, visitMethod, visitObjectInitializerStatements, visitPackage, visitProperty, visitReturnStatement, visitStatement, visitThrowStatement, visitVariableExpression`

    - ### Methods inherited from class org.codehaus.groovy.ast.CodeVisitorSupport

      `visitArgumentlistExpression, visitArrayExpression, visitAttributeExpression, visitBinaryExpression, visitBitwiseNegationExpression, visitBooleanExpression, visitBytecodeExpression, visitCastExpression, visitClassExpression, visitClosureExpression, visitClosureListExpression, visitConstantExpression, visitConstructorCallExpression, visitDeclarationExpression, visitEmptyStatement, visitFieldExpression, visitGStringExpression, visitListExpression, visitListOfExpressions, visitMapEntryExpression, visitMapExpression, visitMethodCallExpression, visitMethodPointerExpression, visitNotExpression, visitPostfixExpression, visitPrefixExpression, visitPropertyExpression, visitRangeExpression, visitRegexExpression, visitShortTernaryExpression, visitSpreadExpression, visitSpreadMapExpression, visitStaticMethodCallExpression, visitTernaryExpression, visitTupleExpression, visitUnaryMinusExpression, visitUnaryPlusExpression`

    - ### 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 Statement replace(Statement stat)

      Visits the specified statement. If the statement's visit method calls replaceVisitedMethodWith(), the statement will be replaced.

    - #### replaceAll

          protected <T extends Statement> void replaceAll(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(Statement other)

      Replaces the currently visited statement with the specified statement.

    - #### visitBlockStatement

          public void visitBlockStatement(BlockStatement stat)

      Specified by:
        `visitBlockStatement` in interface `GroovyCodeVisitor`
      Overrides:
        `visitBlockStatement` in class `ClassCodeVisitorSupport`

    - #### visitForLoop

          public void visitForLoop(ForStatement stat)

      Specified by:
        `visitForLoop` in interface `GroovyCodeVisitor`
      Overrides:
        `visitForLoop` in class `ClassCodeVisitorSupport`

    - #### visitWhileLoop

          public void visitWhileLoop(WhileStatement stat)

      Specified by:
        `visitWhileLoop` in interface `GroovyCodeVisitor`
      Overrides:
        `visitWhileLoop` in class `ClassCodeVisitorSupport`

    - #### visitDoWhileLoop

          public void visitDoWhileLoop(DoWhileStatement stat)

      Specified by:
        `visitDoWhileLoop` in interface `GroovyCodeVisitor`
      Overrides:
        `visitDoWhileLoop` in class `ClassCodeVisitorSupport`

    - #### visitIfElse

          public void visitIfElse(IfStatement stat)

      Specified by:
        `visitIfElse` in interface `GroovyCodeVisitor`
      Overrides:
        `visitIfElse` in class `ClassCodeVisitorSupport`

    - #### visitTryCatchFinally

          public void visitTryCatchFinally(TryCatchStatement stat)

      Specified by:
        `visitTryCatchFinally` in interface `GroovyCodeVisitor`
      Overrides:
        `visitTryCatchFinally` in class `ClassCodeVisitorSupport`

    - #### visitSwitch

          public void visitSwitch(SwitchStatement stat)

      Specified by:
        `visitSwitch` in interface `GroovyCodeVisitor`
      Overrides:
        `visitSwitch` in class `ClassCodeVisitorSupport`

    - #### visitCaseStatement

          public void visitCaseStatement(CaseStatement stat)

      Specified by:
        `visitCaseStatement` in interface `GroovyCodeVisitor`
      Overrides:
        `visitCaseStatement` in class `ClassCodeVisitorSupport`

    - #### visitSynchronizedStatement

          public void visitSynchronizedStatement(SynchronizedStatement stat)

      Specified by:
        `visitSynchronizedStatement` in interface `GroovyCodeVisitor`
      Overrides:
        `visitSynchronizedStatement` in class `ClassCodeVisitorSupport`

    - #### visitCatchStatement

          public void visitCatchStatement(CatchStatement stat)

      Specified by:
        `visitCatchStatement` in interface `GroovyCodeVisitor`
      Overrides:
        `visitCatchStatement` in class `ClassCodeVisitorSupport`