Package org.codehaus.groovy.control

# Class StaticImportVisitor

java.lang.Object
org.codehaus.groovy.ast.CodeVisitorSupport
org.codehaus.groovy.ast.ClassCodeVisitorSupport
org.codehaus.groovy.ast.ClassCodeExpressionTransformer
org.codehaus.groovy.control.StaticImportVisitor

All Implemented Interfaces:
  `ExpressionTransformer`, `GroovyClassVisitor`, `GroovyCodeVisitor`, `ErrorCollecting`

public class StaticImportVisitor extends ClassCodeExpressionTransformer
Visitor to resolve constants and method calls from static imports.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `StaticImportVisitor(ClassNode classNode, SourceUnit sourceUnit)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `protected SourceUnit`
  `getSourceUnit()`
  Provides access to the `SourceUnit` for error reporting during visitation.
  `Expression`
  `transform(Expression exp)`
  NOTE: This method does not visit Expressions within Closures, for performance and historical reasons.
  `protected Expression`
  `transformBinaryExpression(BinaryExpression be)`
  `protected Expression`
  `transformClosureExpression(ClosureExpression ce)`
  `protected Expression`
  `transformConstructorCallExpression(ConstructorCallExpression cce)`
  `protected Expression`
  `transformMethodCallExpression(MethodCallExpression mce)`
  `protected Expression`
  `transformPropertyExpression(PropertyExpression pe)`
  `protected Expression`
  `transformVariableExpression(VariableExpression ve)`
  `void`
  `visitAnnotations(AnnotatedNode node)`
  Visits annotations on an `AnnotatedNode`, delegating to `ClassCodeVisitorSupport.visitAnnotation(AnnotationNode)`.
  `void`
  `visitClass(ClassNode classNode, SourceUnit sourceUnit)`
  Deprecated.
  `protected void`
  `visitConstructorOrMethod(MethodNode node, boolean isConstructor)`
  Visits a constructor or method node (implementation detail for both visit methods).

  ### Methods inherited from class org.codehaus.groovy.ast.ClassCodeExpressionTransformer

  `setSourcePosition, visitAnnotation, visitAssertStatement, visitCaseStatement, visitClosureExpression, visitDoWhileLoop, visitExpressionStatement, visitField, visitForLoop, visitIfElse, visitProperty, visitReturnStatement, visitSwitch, visitSynchronizedStatement, visitThrowStatement, visitWhileLoop`

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

  `addError, visitAnnotations, visitBlockStatement, visitBreakStatement, visitCatchStatement, visitClass, visitClassCodeContainer, visitConstructor, visitContinueStatement, visitDeclarationExpression, visitImports, visitMethod, visitObjectInitializerStatements, visitPackage, visitStatement, visitStatementAnnotations, visitTryCatchFinally`

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

  `afterSwitchCaseStatementsVisited, afterSwitchConditionExpressionVisited, visitArgumentlistExpression, visitArrayExpression, visitAttributeExpression, visitBinaryExpression, visitBitwiseNegationExpression, visitBooleanExpression, visitBytecodeExpression, visitCastExpression, visitClassExpression, visitClosureListExpression, visitConstantExpression, visitConstructorCallExpression, visitEmptyStatement, visitFieldExpression, visitGStringExpression, visitLambdaExpression, visitListExpression, visitMapEntryExpression, visitMapExpression, visitMethodCallExpression, visitMethodPointerExpression, visitMethodReferenceExpression, 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`

  ### Methods inherited from interface org.codehaus.groovy.ast.GroovyCodeVisitor

  `visit, visit, visitEmptyExpression, visitListOfExpressions`

- ## Constructor Details

  - ### StaticImportVisitor

    public StaticImportVisitor(ClassNode classNode, SourceUnit sourceUnit)

- ## Method Details

  - ### visitClass

    @Deprecated public void visitClass(ClassNode classNode, SourceUnit sourceUnit)
    Deprecated.
    Call `StaticImportVisitor(ClassNode,SourceUnit)` then `ClassCodeVisitorSupport.visitClass(ClassNode)`.

  - ### visitConstructorOrMethod

    protected void visitConstructorOrMethod(MethodNode node, boolean isConstructor)
    Description copied from class: `ClassCodeVisitorSupport`
    Visits a constructor or method node (implementation detail for both visit methods). Processes the node's annotations, all parameter annotations, and code block.
    Overrides:
      `visitConstructorOrMethod` in class `ClassCodeExpressionTransformer`
    Parameters:
      `node` - the method or constructor node
      `isConstructor` - true if node is a constructor, false if it is a method

  - ### visitAnnotations

    public void visitAnnotations(AnnotatedNode node)
    Description copied from class: `ClassCodeVisitorSupport`
    Visits annotations on an `AnnotatedNode`, delegating to `ClassCodeVisitorSupport.visitAnnotation(AnnotationNode)`.
    Overrides:
      `visitAnnotations` in class `ClassCodeVisitorSupport`
    Parameters:
      `node` - the annotated node containing annotations to visit

  - ### transform

    public Expression transform(Expression exp)
    Description copied from class: `ClassCodeExpressionTransformer`
    NOTE: This method does not visit Expressions within Closures, for performance and historical reasons. If you want those Expressions to be visited, you can do this:

         public class YourTransformer extends ClassCodeExpressionTransformer {
           ...

           @Override
           public Expression transform(final Expression expr) {
             if (expr instanceof ClosureExpression) {
               expr.visit(this);

               return expr;
             }
             // ...
           }
         }

    Specified by:
      `transform` in interface `ExpressionTransformer`
    Overrides:
      `transform` in class `ClassCodeExpressionTransformer`
    Parameters:
      `exp` - the expression to transform, may be null
    Returns:
      the transformed expression, may be the same instance, a new instance, or null

  - ### transformBinaryExpression

    protected Expression transformBinaryExpression(BinaryExpression be)

  - ### transformVariableExpression

    protected Expression transformVariableExpression(VariableExpression ve)

  - ### transformMethodCallExpression

    protected Expression transformMethodCallExpression(MethodCallExpression mce)

  - ### transformConstructorCallExpression

    protected Expression transformConstructorCallExpression(ConstructorCallExpression cce)

  - ### transformClosureExpression

    protected Expression transformClosureExpression(ClosureExpression ce)

  - ### transformPropertyExpression

    protected Expression transformPropertyExpression(PropertyExpression pe)

  - ### getSourceUnit

    protected SourceUnit getSourceUnit()
    Description copied from class: `ClassCodeVisitorSupport`
    Provides access to the `SourceUnit` for error reporting during visitation. Implementations must override this method.
    Specified by:
      `getSourceUnit` in class `ClassCodeVisitorSupport`
    Returns:
      the source unit for this visitor