Interface ExpressionTransformer

All Known Implementing Classes:
ClassCodeExpressionTransformer, FieldASTTransformation, JavaAwareResolveVisitor, NewifyASTTransformation, OperatorRenameASTTransformation, OptimizerVisitor, ResolveVisitor, StaticCompilationTransformer, StaticImportVisitor, VariableExpressionTransformer
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface ExpressionTransformer
Functional interface for transforming Expression nodes during AST traversal and manipulation.

This transformer interface enables expression-level transformations in AST processing. Implementations typically take an input expression and return a (possibly modified) expression. This can be used for:

  • Code generation and transformation passes
  • Expression normalization or optimization
  • Type-driven transformation in static type checking
  • Custom DSL implementation and metaprogramming

Transformers may return:

  • The same expression instance unchanged
  • A new expression of the same type with modified properties
  • A completely different expression type
  • Null if the expression should be removed (usage-dependent)

This is a functional interface and can be implemented as a lambda expression.

See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    transform(Expression expression)
    Transforms the given expression.
  • Method Details

    • transform

      Expression transform(Expression expression)
      Transforms the given expression.
      Parameters:
      expression - the expression to transform, may be null
      Returns:
      the transformed expression, may be the same instance, a new instance, or null