Package org.codehaus.groovy.ast

# Class GroovyCodeVisitorAdapter

java.lang.Object
org.codehaus.groovy.ast.GroovyCodeVisitorAdapter

All Implemented Interfaces:
  `GroovyCodeVisitor`

public class GroovyCodeVisitorAdapter extends Object implements GroovyCodeVisitor
Adapter class providing default no-op implementations of all methods in the `GroovyCodeVisitor` interface. Subclasses can override only the visitor methods relevant to their use case, simplifying implementation of custom AST visitors that do not need to handle all node types.

The adapter includes delegation strategies for related expression types: `visitDeclarationExpression()` delegates to `visitBinaryExpression()`; `visitNotExpression()` delegates to `visitBooleanExpression()`; `visitLambdaExpression()` delegates to `visitClosureExpression()`; `visitAttributeExpression()` delegates to `visitPropertyExpression()`; `visitArgumentlistExpression()` delegates to `visitTupleExpression()`; `visitClosureListExpression()` delegates to `visitListExpression()`; `visitMethodReferenceExpression()` delegates to `visitMethodPointerExpression()`; `visitShortTernaryExpression()` (elvis operator) delegates to `visitTernaryExpression()`.

Since:
  4.0.0
See Also:
  - `GroovyCodeVisitor`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `GroovyCodeVisitorAdapter()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `visitArgumentlistExpression(ArgumentListExpression expression)`
  Visits an `ArgumentListExpression`.
  `void`
  `visitArrayExpression(ArrayExpression expression)`
  Visits an `ArrayExpression`.
  `void`
  `visitAssertStatement(AssertStatement statement)`
  Visits an `AssertStatement`.
  `void`
  `visitAttributeExpression(AttributeExpression expression)`
  Visits an `AttributeExpression`.
  `void`
  `visitBinaryExpression(BinaryExpression expression)`
  Visits a `BinaryExpression`.
  `void`
  `visitBitwiseNegationExpression(BitwiseNegationExpression expression)`
  Visits a `BitwiseNegationExpression`.
  `void`
  `visitBlockStatement(BlockStatement statement)`
  Visits a `BlockStatement`.
  `void`
  `visitBooleanExpression(BooleanExpression expression)`
  Visits a `BooleanExpression`.
  `void`
  `visitBreakStatement(BreakStatement statement)`
  Visits a `BreakStatement`.
  `void`
  `visitBytecodeExpression(BytecodeExpression expression)`
  Visits a `BytecodeExpression`.
  `void`
  `visitCaseStatement(CaseStatement statement)`
  Visits a `CaseStatement`.
  `void`
  `visitCastExpression(CastExpression expression)`
  Visits a `CastExpression`.
  `void`
  `visitCatchStatement(CatchStatement statement)`
  Visits a `CatchStatement`.
  `void`
  `visitClassExpression(ClassExpression expression)`
  Visits a `ClassExpression`.
  `void`
  `visitClosureExpression(ClosureExpression expression)`
  Visits a `ClosureExpression`.
  `void`
  `visitClosureListExpression(ClosureListExpression expression)`
  Visits a `ClosureListExpression`.
  `void`
  `visitConstantExpression(ConstantExpression expression)`
  Visits a `ConstantExpression`.
  `void`
  `visitConstructorCallExpression(ConstructorCallExpression expression)`
  Visits a `ConstructorCallExpression`.
  `void`
  `visitContinueStatement(ContinueStatement statement)`
  Visits a `ContinueStatement`.
  `void`
  `visitDeclarationExpression(DeclarationExpression expression)`
  Visits a `DeclarationExpression`.
  `void`
  `visitDoWhileLoop(DoWhileStatement statement)`
  Visits a `DoWhileStatement`.
  `void`
  `visitEmptyExpression(EmptyExpression expression)`
  Visits an `EmptyExpression`.
  `void`
  `visitEmptyStatement(EmptyStatement statement)`
  Visits an `EmptyStatement`.
  `void`
  `visitExpressionStatement(ExpressionStatement statement)`
  Visits an `ExpressionStatement`.
  `void`
  `visitFieldExpression(FieldExpression expression)`
  Visits a `FieldExpression`.
  `void`
  `visitForLoop(ForStatement statement)`
  Visits a `ForStatement`.
  `void`
  `visitGStringExpression(GStringExpression expression)`
  Visits a `GStringExpression`.
  `void`
  `visitIfElse(IfStatement statement)`
  Visits an `IfStatement`.
  `void`
  `visitLambdaExpression(LambdaExpression expression)`
  Visits a `LambdaExpression`.
  `void`
  `visitListExpression(ListExpression expression)`
  Visits a `ListExpression`.
  `void`
  `visitMapEntryExpression(MapEntryExpression expression)`
  Visits a `MapEntryExpression`.
  `void`
  `visitMapExpression(MapExpression expression)`
  Visits a `MapExpression`.
  `void`
  `visitMethodCallExpression(MethodCallExpression expression)`
  Visits a `MethodCallExpression`.
  `void`
  `visitMethodPointerExpression(MethodPointerExpression expression)`
  Visits a `MethodPointerExpression`.
  `void`
  `visitMethodReferenceExpression(MethodReferenceExpression expression)`
  Visits a `MethodReferenceExpression`.
  `void`
  `visitNotExpression(NotExpression expression)`
  Visits a `NotExpression`.
  `void`
  `visitPostfixExpression(PostfixExpression expression)`
  Visits a `PostfixExpression`.
  `void`
  `visitPrefixExpression(PrefixExpression expression)`
  Visits a `PrefixExpression`.
  `void`
  `visitPropertyExpression(PropertyExpression expression)`
  Visits a `PropertyExpression`.
  `void`
  `visitRangeExpression(RangeExpression expression)`
  Visits a `RangeExpression`.
  `void`
  `visitReturnStatement(ReturnStatement statement)`
  Visits a `ReturnStatement`.
  `void`
  `visitShortTernaryExpression(ElvisOperatorExpression expression)`
  Visits an `ElvisOperatorExpression` (short ternary operator).
  `void`
  `visitSpreadExpression(SpreadExpression expression)`
  Visits a `SpreadExpression`.
  `void`
  `visitSpreadMapExpression(SpreadMapExpression expression)`
  Visits a `SpreadMapExpression`.
  `void`
  `visitStaticMethodCallExpression(StaticMethodCallExpression expression)`
  Visits a `StaticMethodCallExpression`.
  `void`
  `visitSwitch(SwitchStatement statement)`
  Visits a `SwitchStatement`.
  `void`
  `visitSynchronizedStatement(SynchronizedStatement statement)`
  Visits a `SynchronizedStatement`.
  `void`
  `visitTernaryExpression(TernaryExpression expression)`
  Visits a `TernaryExpression`.
  `void`
  `visitThrowStatement(ThrowStatement statement)`
  Visits a `ThrowStatement`.
  `void`
  `visitTryCatchFinally(TryCatchStatement statement)`
  Visits a `TryCatchStatement`.
  `void`
  `visitTupleExpression(TupleExpression expression)`
  Visits a `TupleExpression`.
  `void`
  `visitUnaryMinusExpression(UnaryMinusExpression expression)`
  Visits a `UnaryMinusExpression`.
  `void`
  `visitUnaryPlusExpression(UnaryPlusExpression expression)`
  Visits a `UnaryPlusExpression`.
  `void`
  `visitVariableExpression(VariableExpression expression)`
  Visits a `VariableExpression`.
  `void`
  `visitWhileLoop(WhileStatement statement)`
  Visits a `WhileStatement`.

  ### 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, visitListOfExpressions`

- ## Constructor Details

  - ### GroovyCodeVisitorAdapter

    public GroovyCodeVisitorAdapter()

- ## Method Details

  - ### visitAssertStatement

    public void visitAssertStatement(AssertStatement statement)
    Visits an `AssertStatement`. Default implementation is no-op.
    Specified by:
      `visitAssertStatement` in interface `GroovyCodeVisitor`
    Parameters:
      `statement` - the assert statement

  - ### visitBlockStatement

    public void visitBlockStatement(BlockStatement statement)
    Visits a `BlockStatement`. Default implementation is no-op.
    Specified by:
      `visitBlockStatement` in interface `GroovyCodeVisitor`
    Parameters:
      `statement` - the block statement

  - ### visitBreakStatement

    public void visitBreakStatement(BreakStatement statement)
    Visits a `BreakStatement`. Default implementation is no-op.
    Specified by:
      `visitBreakStatement` in interface `GroovyCodeVisitor`
    Parameters:
      `statement` - the break statement

  - ### visitCaseStatement

    public void visitCaseStatement(CaseStatement statement)
    Visits a `CaseStatement`. Default implementation is no-op.
    Specified by:
      `visitCaseStatement` in interface `GroovyCodeVisitor`
    Parameters:
      `statement` - the case statement

  - ### visitCatchStatement

    public void visitCatchStatement(CatchStatement statement)
    Visits a `CatchStatement`. Default implementation is no-op.
    Specified by:
      `visitCatchStatement` in interface `GroovyCodeVisitor`
    Parameters:
      `statement` - the catch statement

  - ### visitContinueStatement

    public void visitContinueStatement(ContinueStatement statement)
    Visits a `ContinueStatement`. Default implementation is no-op.
    Specified by:
      `visitContinueStatement` in interface `GroovyCodeVisitor`
    Parameters:
      `statement` - the continue statement

  - ### visitDoWhileLoop

    public void visitDoWhileLoop(DoWhileStatement statement)
    Visits a `DoWhileStatement`. Default implementation is no-op.
    Specified by:
      `visitDoWhileLoop` in interface `GroovyCodeVisitor`
    Parameters:
      `statement` - the do-while loop statement

  - ### visitEmptyStatement

    public void visitEmptyStatement(EmptyStatement statement)
    Visits an `EmptyStatement`. Default implementation is no-op.
    Specified by:
      `visitEmptyStatement` in interface `GroovyCodeVisitor`
    Parameters:
      `statement` - the empty statement

  - ### visitExpressionStatement

    public void visitExpressionStatement(ExpressionStatement statement)
    Visits an `ExpressionStatement`. Default implementation is no-op.
    Specified by:
      `visitExpressionStatement` in interface `GroovyCodeVisitor`
    Parameters:
      `statement` - the expression statement

  - ### visitForLoop

    public void visitForLoop(ForStatement statement)
    Visits a `ForStatement`. Default implementation is no-op.
    Specified by:
      `visitForLoop` in interface `GroovyCodeVisitor`
    Parameters:
      `statement` - the for loop statement

  - ### visitIfElse

    public void visitIfElse(IfStatement statement)
    Visits an `IfStatement`. Default implementation is no-op.
    Specified by:
      `visitIfElse` in interface `GroovyCodeVisitor`
    Parameters:
      `statement` - the if-else statement

  - ### visitReturnStatement

    public void visitReturnStatement(ReturnStatement statement)
    Visits a `ReturnStatement`. Default implementation is no-op.
    Specified by:
      `visitReturnStatement` in interface `GroovyCodeVisitor`
    Parameters:
      `statement` - the return statement

  - ### visitSwitch

    public void visitSwitch(SwitchStatement statement)
    Visits a `SwitchStatement`. Default implementation is no-op.
    Specified by:
      `visitSwitch` in interface `GroovyCodeVisitor`
    Parameters:
      `statement` - the switch statement

  - ### visitSynchronizedStatement

    public void visitSynchronizedStatement(SynchronizedStatement statement)
    Visits a `SynchronizedStatement`. Default implementation is no-op.
    Specified by:
      `visitSynchronizedStatement` in interface `GroovyCodeVisitor`
    Parameters:
      `statement` - the synchronized statement

  - ### visitThrowStatement

    public void visitThrowStatement(ThrowStatement statement)
    Visits a `ThrowStatement`. Default implementation is no-op.
    Specified by:
      `visitThrowStatement` in interface `GroovyCodeVisitor`
    Parameters:
      `statement` - the throw statement

  - ### visitTryCatchFinally

    public void visitTryCatchFinally(TryCatchStatement statement)
    Visits a `TryCatchStatement`. Default implementation is no-op.
    Specified by:
      `visitTryCatchFinally` in interface `GroovyCodeVisitor`
    Parameters:
      `statement` - the try-catch-finally statement

  - ### visitWhileLoop

    public void visitWhileLoop(WhileStatement statement)
    Visits a `WhileStatement`. Default implementation is no-op.
    Specified by:
      `visitWhileLoop` in interface `GroovyCodeVisitor`
    Parameters:
      `statement` - the while loop statement

  - ### visitArgumentlistExpression

    public void visitArgumentlistExpression(ArgumentListExpression expression)
    Visits an `ArgumentListExpression`. Default implementation delegates to `visitTupleExpression(TupleExpression)`.
    Specified by:
      `visitArgumentlistExpression` in interface `GroovyCodeVisitor`
    Parameters:
      `expression` - the argument list expression

  - ### visitArrayExpression

    public void visitArrayExpression(ArrayExpression expression)
    Visits an `ArrayExpression`. Default implementation is no-op.
    Specified by:
      `visitArrayExpression` in interface `GroovyCodeVisitor`
    Parameters:
      `expression` - the array expression

  - ### visitAttributeExpression

    public void visitAttributeExpression(AttributeExpression expression)
    Visits an `AttributeExpression`. Default implementation delegates to `visitPropertyExpression(PropertyExpression)`.
    Specified by:
      `visitAttributeExpression` in interface `GroovyCodeVisitor`
    Parameters:
      `expression` - the attribute expression

  - ### visitBinaryExpression

    public void visitBinaryExpression(BinaryExpression expression)
    Visits a `BinaryExpression`. Default implementation is no-op.
    Specified by:
      `visitBinaryExpression` in interface `GroovyCodeVisitor`
    Parameters:
      `expression` - the binary expression

  - ### visitBitwiseNegationExpression

    public void visitBitwiseNegationExpression(BitwiseNegationExpression expression)
    Visits a `BitwiseNegationExpression`. Default implementation is no-op.
    Specified by:
      `visitBitwiseNegationExpression` in interface `GroovyCodeVisitor`
    Parameters:
      `expression` - the bitwise negation expression

  - ### visitBooleanExpression

    public void visitBooleanExpression(BooleanExpression expression)
    Visits a `BooleanExpression`. Default implementation is no-op.
    Specified by:
      `visitBooleanExpression` in interface `GroovyCodeVisitor`
    Parameters:
      `expression` - the boolean expression

  - ### visitBytecodeExpression

    public void visitBytecodeExpression(BytecodeExpression expression)
    Visits a `BytecodeExpression`. Default implementation is no-op.
    Specified by:
      `visitBytecodeExpression` in interface `GroovyCodeVisitor`
    Parameters:
      `expression` - the bytecode expression

  - ### visitCastExpression

    public void visitCastExpression(CastExpression expression)
    Visits a `CastExpression`. Default implementation is no-op.
    Specified by:
      `visitCastExpression` in interface `GroovyCodeVisitor`
    Parameters:
      `expression` - the cast expression

  - ### visitClassExpression

    public void visitClassExpression(ClassExpression expression)
    Visits a `ClassExpression`. Default implementation is no-op.
    Specified by:
      `visitClassExpression` in interface `GroovyCodeVisitor`
    Parameters:
      `expression` - the class expression

  - ### visitClosureExpression

    public void visitClosureExpression(ClosureExpression expression)
    Visits a `ClosureExpression`. Default implementation is no-op.
    Specified by:
      `visitClosureExpression` in interface `GroovyCodeVisitor`
    Parameters:
      `expression` - the closure expression

  - ### visitClosureListExpression

    public void visitClosureListExpression(ClosureListExpression expression)
    Visits a `ClosureListExpression`. Default implementation delegates to `visitListExpression(ListExpression)`.
    Specified by:
      `visitClosureListExpression` in interface `GroovyCodeVisitor`
    Parameters:
      `expression` - the closure list expression

  - ### visitConstantExpression

    public void visitConstantExpression(ConstantExpression expression)
    Visits a `ConstantExpression`. Default implementation is no-op.
    Specified by:
      `visitConstantExpression` in interface `GroovyCodeVisitor`
    Parameters:
      `expression` - the constant expression

  - ### visitConstructorCallExpression

    public void visitConstructorCallExpression(ConstructorCallExpression expression)
    Visits a `ConstructorCallExpression`. Default implementation is no-op.
    Specified by:
      `visitConstructorCallExpression` in interface `GroovyCodeVisitor`
    Parameters:
      `expression` - the constructor call expression

  - ### visitDeclarationExpression

    public void visitDeclarationExpression(DeclarationExpression expression)
    Visits a `DeclarationExpression`. Default implementation delegates to `visitBinaryExpression(BinaryExpression)`.
    Specified by:
      `visitDeclarationExpression` in interface `GroovyCodeVisitor`
    Parameters:
      `expression` - the declaration expression

  - ### visitEmptyExpression

    public void visitEmptyExpression(EmptyExpression expression)
    Visits an `EmptyExpression`. Default implementation is no-op.
    Specified by:
      `visitEmptyExpression` in interface `GroovyCodeVisitor`
    Parameters:
      `expression` - the empty expression

  - ### visitFieldExpression

    public void visitFieldExpression(FieldExpression expression)
    Visits a `FieldExpression`. Default implementation is no-op.
    Specified by:
      `visitFieldExpression` in interface `GroovyCodeVisitor`
    Parameters:
      `expression` - the field expression

  - ### visitGStringExpression

    public void visitGStringExpression(GStringExpression expression)
    Visits a `GStringExpression`. Default implementation is no-op.
    Specified by:
      `visitGStringExpression` in interface `GroovyCodeVisitor`
    Parameters:
      `expression` - the GString expression

  - ### visitLambdaExpression

    public void visitLambdaExpression(LambdaExpression expression)
    Visits a `LambdaExpression`. Default implementation delegates to `visitClosureExpression(ClosureExpression)`.
    Specified by:
      `visitLambdaExpression` in interface `GroovyCodeVisitor`
    Parameters:
      `expression` - the lambda expression

  - ### visitListExpression

    public void visitListExpression(ListExpression expression)
    Visits a `ListExpression`. Default implementation is no-op.
    Specified by:
      `visitListExpression` in interface `GroovyCodeVisitor`
    Parameters:
      `expression` - the list expression

  - ### visitMapExpression

    public void visitMapExpression(MapExpression expression)
    Visits a `MapExpression`. Default implementation is no-op.
    Specified by:
      `visitMapExpression` in interface `GroovyCodeVisitor`
    Parameters:
      `expression` - the map expression

  - ### visitMapEntryExpression

    public void visitMapEntryExpression(MapEntryExpression expression)
    Visits a `MapEntryExpression`. Default implementation is no-op.
    Specified by:
      `visitMapEntryExpression` in interface `GroovyCodeVisitor`
    Parameters:
      `expression` - the map entry expression

  - ### visitMethodCallExpression

    public void visitMethodCallExpression(MethodCallExpression expression)
    Visits a `MethodCallExpression`. Default implementation is no-op.
    Specified by:
      `visitMethodCallExpression` in interface `GroovyCodeVisitor`
    Parameters:
      `expression` - the method call expression

  - ### visitMethodPointerExpression

    public void visitMethodPointerExpression(MethodPointerExpression expression)
    Visits a `MethodPointerExpression`. Default implementation is no-op.
    Specified by:
      `visitMethodPointerExpression` in interface `GroovyCodeVisitor`
    Parameters:
      `expression` - the method pointer expression

  - ### visitMethodReferenceExpression

    public void visitMethodReferenceExpression(MethodReferenceExpression expression)
    Visits a `MethodReferenceExpression`. Default implementation delegates to `visitMethodPointerExpression(MethodPointerExpression)`.
    Specified by:
      `visitMethodReferenceExpression` in interface `GroovyCodeVisitor`
    Parameters:
      `expression` - the method reference expression

  - ### visitNotExpression

    public void visitNotExpression(NotExpression expression)
    Visits a `NotExpression`. Default implementation delegates to `visitBooleanExpression(BooleanExpression)`.
    Specified by:
      `visitNotExpression` in interface `GroovyCodeVisitor`
    Parameters:
      `expression` - the not expression

  - ### visitPostfixExpression

    public void visitPostfixExpression(PostfixExpression expression)
    Visits a `PostfixExpression`. Default implementation is no-op.
    Specified by:
      `visitPostfixExpression` in interface `GroovyCodeVisitor`
    Parameters:
      `expression` - the postfix expression

  - ### visitPrefixExpression

    public void visitPrefixExpression(PrefixExpression expression)
    Visits a `PrefixExpression`. Default implementation is no-op.
    Specified by:
      `visitPrefixExpression` in interface `GroovyCodeVisitor`
    Parameters:
      `expression` - the prefix expression

  - ### visitPropertyExpression

    public void visitPropertyExpression(PropertyExpression expression)
    Visits a `PropertyExpression`. Default implementation is no-op.
    Specified by:
      `visitPropertyExpression` in interface `GroovyCodeVisitor`
    Parameters:
      `expression` - the property expression

  - ### visitRangeExpression

    public void visitRangeExpression(RangeExpression expression)
    Visits a `RangeExpression`. Default implementation is no-op.
    Specified by:
      `visitRangeExpression` in interface `GroovyCodeVisitor`
    Parameters:
      `expression` - the range expression

  - ### visitShortTernaryExpression

    public void visitShortTernaryExpression(ElvisOperatorExpression expression)
    Visits an `ElvisOperatorExpression` (short ternary operator). Default implementation delegates to `visitTernaryExpression(TernaryExpression)`.
    Specified by:
      `visitShortTernaryExpression` in interface `GroovyCodeVisitor`
    Parameters:
      `expression` - the elvis operator expression

  - ### visitSpreadExpression

    public void visitSpreadExpression(SpreadExpression expression)
    Visits a `SpreadExpression`. Default implementation is no-op.
    Specified by:
      `visitSpreadExpression` in interface `GroovyCodeVisitor`
    Parameters:
      `expression` - the spread expression

  - ### visitSpreadMapExpression

    public void visitSpreadMapExpression(SpreadMapExpression expression)
    Visits a `SpreadMapExpression`. Default implementation is no-op.
    Specified by:
      `visitSpreadMapExpression` in interface `GroovyCodeVisitor`
    Parameters:
      `expression` - the spread map expression

  - ### visitStaticMethodCallExpression

    public void visitStaticMethodCallExpression(StaticMethodCallExpression expression)
    Visits a `StaticMethodCallExpression`. Default implementation is no-op.
    Specified by:
      `visitStaticMethodCallExpression` in interface `GroovyCodeVisitor`
    Parameters:
      `expression` - the static method call expression

  - ### visitTernaryExpression

    public void visitTernaryExpression(TernaryExpression expression)
    Visits a `TernaryExpression`. Default implementation is no-op.
    Specified by:
      `visitTernaryExpression` in interface `GroovyCodeVisitor`
    Parameters:
      `expression` - the ternary expression

  - ### visitTupleExpression

    public void visitTupleExpression(TupleExpression expression)
    Visits a `TupleExpression`. Default implementation is no-op.
    Specified by:
      `visitTupleExpression` in interface `GroovyCodeVisitor`
    Parameters:
      `expression` - the tuple expression

  - ### visitVariableExpression

    public void visitVariableExpression(VariableExpression expression)
    Visits a `VariableExpression`. Default implementation is no-op.
    Specified by:
      `visitVariableExpression` in interface `GroovyCodeVisitor`
    Parameters:
      `expression` - the variable expression

  - ### visitUnaryMinusExpression

    public void visitUnaryMinusExpression(UnaryMinusExpression expression)
    Visits a `UnaryMinusExpression`. Default implementation is no-op.
    Specified by:
      `visitUnaryMinusExpression` in interface `GroovyCodeVisitor`
    Parameters:
      `expression` - the unary minus expression

  - ### visitUnaryPlusExpression

    public void visitUnaryPlusExpression(UnaryPlusExpression expression)
    Visits a `UnaryPlusExpression`. Default implementation is no-op.
    Specified by:
      `visitUnaryPlusExpression` in interface `GroovyCodeVisitor`
    Parameters:
      `expression` - the unary plus expression