Package org.codehaus.groovy.macro.transform

# Class MacroTransformation

java.lang.Object
org.codehaus.groovy.ast.MethodCallTransformation
org.codehaus.groovy.macro.transform.MacroTransformation

All Implemented Interfaces:
  `CompilationUnitAware`, `ASTTransformation`

public class MacroTransformation extends MethodCallTransformation implements CompilationUnitAware

Since:
  2.5.0

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected CompilationUnit`
  `unit`
  Compilation unit that owns the current transformation.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `MacroTransformation()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `protected GroovyCodeVisitor`
  `getTransformer(ASTNode[] nodes, SourceUnit sourceUnit)`
  Creates the visitor that rewrites macro method calls.
  `void`
  `setCompilationUnit(CompilationUnit unit)`
  Stores the current compilation unit for later macro expansion.

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

  `visit`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### unit

    protected CompilationUnit unit
    Compilation unit that owns the current transformation.

- ## Constructor Details

  - ### MacroTransformation

    public MacroTransformation()

- ## Method Details

  - ### setCompilationUnit

    public void setCompilationUnit(CompilationUnit unit)
    Stores the current compilation unit for later macro expansion.
    Specified by:
      `setCompilationUnit` in interface `CompilationUnitAware`
    Parameters:
      `unit` - the current compilation unit

  - ### getTransformer

    protected GroovyCodeVisitor getTransformer(ASTNode[] nodes, SourceUnit sourceUnit)
    Creates the visitor that rewrites macro method calls.
    Specified by:
      `getTransformer` in class `MethodCallTransformation`
    Parameters:
      `nodes` - the visited nodes
      `sourceUnit` - the current source unit
    Returns:
      the macro-transforming visitor