ASTTransformationVisitor (Groovy 5.0.6)

Package: org.codehaus.groovy.transform

## [Java] Class ASTTransformationVisitor

- org.codehaus.groovy.transform.ASTTransformationVisitor

-     public final class ASTTransformationVisitor
      extends ClassCodeVisitorSupport

  This class handles the invocation of the ASTAnnotationTransformation when it is encountered by a tree walk. One instance of each exists for each phase of the compilation it applies to. Before invocation the

  ASTTransformationCollectorCodeVisitor will add a list of annotations that this visitor should be concerned about. All other annotations are ignored, whether they are GroovyASTTransformation annotated or not.

  A Two-pass method is used. First all candidate annotations are added to a list then the transformations are called on those collected annotations. This is done to avoid concurrent modification exceptions during the AST tree walk and allows the transformations to alter any portion of the AST tree. Hence annotations that are added in this phase will not be processed as transformations. They will only be handled in later phases (and then only if the type was in the AST prior to any AST transformations being run against it).

- - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `public static void` | `addGlobalTransforms(ASTTransformationsContext context)`
    `` | `public static void` | `addGlobalTransformsAfterGrab(ASTTransformationsContext context)`
    `` | `public static void` | `addNewPhaseOperation(CompilationUnit compilationUnit, SourceUnit sourceUnit, ClassNode classNode)` Enables transforms for class that was added during current phase.
    `` | `public static void` | `addPhaseOperations(CompilationUnit compilationUnit)`
    `` | `protected SourceUnit` | `getSourceUnit()`
    `` | `public void` | `visitAnnotations(AnnotatedNode node)` Adds the annotation to the internal target list if a match is found.
    `` | `public void` | `visitClass(ClassNode classNode)` Main loop entry.
    `` | `public void` | `visitProperty(PropertyNode node)`

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class ClassCodeVisitorSupport` | `addError, getSourceUnit, visitAnnotation, visitAnnotations, visitAnnotations, visitAssertStatement, visitBlockStatement, visitBreakStatement, visitCaseStatement, visitCatchStatement, visitClass, visitClassCodeContainer, visitClosureExpression, visitConstructor, visitConstructorOrMethod, visitContinueStatement, visitDeclarationExpression, visitDoWhileLoop, visitExpressionStatement, visitField, visitForLoop, visitIfElse, visitImports, visitMethod, visitObjectInitializerStatements, visitPackage, visitProperty, visitReturnStatement, visitStatement, visitSwitch, visitSynchronizedStatement, visitThrowStatement, visitTryCatchFinally, visitWhileLoop`
    `class CodeVisitorSupport` | `afterSwitchCaseStatementsVisited, afterSwitchConditionExpressionVisited, visitArgumentlistExpression, visitArrayExpression, visitAssertStatement, visitAttributeExpression, visitBinaryExpression, visitBitwiseNegationExpression, visitBlockStatement, visitBooleanExpression, visitBreakStatement, visitBytecodeExpression, visitCaseStatement, visitCastExpression, visitCatchStatement, visitClassExpression, visitClosureExpression, visitClosureListExpression, visitConstantExpression, visitConstructorCallExpression, visitContinueStatement, visitDeclarationExpression, visitDoWhileLoop, visitEmptyStatement, visitExpressionStatement, visitFieldExpression, visitForLoop, visitGStringExpression, visitIfElse, visitLambdaExpression, visitListExpression, visitMapEntryExpression, visitMapExpression, visitMethodCallExpression, visitMethodPointerExpression, visitMethodReferenceExpression, visitNotExpression, visitPostfixExpression, visitPrefixExpression, visitPropertyExpression, visitRangeExpression, visitReturnStatement, visitShortTernaryExpression, visitSpreadExpression, visitSpreadMapExpression, visitStaticMethodCallExpression, visitSwitch, visitSynchronizedStatement, visitTernaryExpression, visitThrowStatement, visitTryCatchFinally, visitTupleExpression, visitUnaryMinusExpression, visitUnaryPlusExpression, visitVariableExpression, visitWhileLoop`

- - ### Method Detail

    - #### public static void addGlobalTransforms(ASTTransformationsContext context)

    - #### public static void addGlobalTransformsAfterGrab(ASTTransformationsContext context)

    - #### public static void addNewPhaseOperation(CompilationUnit compilationUnit, SourceUnit sourceUnit, ClassNode classNode)

      Enables transforms for class that was added during current phase.

    - #### public static void addPhaseOperations(CompilationUnit compilationUnit)

    - #### @Override
      protected SourceUnit getSourceUnit()

    - #### @Override
      public void visitAnnotations(AnnotatedNode node)

      Adds the annotation to the internal target list if a match is found.

      Parameters:
        `node` - the node to be processed

    - #### @Override
      public void visitClass(ClassNode classNode)

      Main loop entry.

      First, it delegates to the super visitClass so we can collect the relevant annotations in an AST tree walk.

      Second, it calls the visit method on the transformation for each relevant annotation found.

      Parameters:
        `classNode` - the class to visit

    - #### @Override
      public void visitProperty(PropertyNode node)