Package org.codehaus.groovy.control

# Interface CompilationUnit.IPrimaryClassNodeOperation

All Known Implementing Classes:
  `CompilationCustomizer`, `CompilationUnit.PrimaryClassNodeOperation`, `DelegatingCustomizer`, `ImportCustomizer`, `SecureASTCustomizer`, `SourceAwareCustomizer`

Enclosing class:
  CompilationUnit

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 static interface CompilationUnit.IPrimaryClassNodeOperation
Performs an operation for each primary class node in the compilation.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `call(SourceUnit source, GeneratorContext context, ClassNode classNode)`
  Performs the operation for one primary class node.
  `default void`
  `doPhaseOperation(CompilationUnit unit)`
  A loop driver for applying operations to all primary ClassNodes in our AST.
  `default boolean`
  `needSortedInput()`
  Indicates whether primary classes should be sorted before visiting.

- ## Method Details

  - ### call

    void call(SourceUnit source, GeneratorContext context, ClassNode classNode) throws CompilationFailedException
    Performs the operation for one primary class node.
    Parameters:
      `source` - the source unit owning the class, or `null` when the class node was supplied directly via `CompilationUnit.addClassNode(ClassNode)` and so has no originating source. Implementations must tolerate `null` here: an unguarded dereference is reported as a `GroovyBugError` wrapping the `NullPointerException`, which reads as a compiler bug rather than as a fault in the implementation.
      `context` - the current generator context
      `classNode` - the class node to process
    Throws:
      `CompilationFailedException` - if processing fails

  - ### doPhaseOperation

    default void doPhaseOperation(CompilationUnit unit) throws CompilationFailedException
    A loop driver for applying operations to all primary ClassNodes in our AST. Automatically skips units that have already been processed through the current phase.
    Throws:
      `CompilationFailedException`

  - ### needSortedInput

    default boolean needSortedInput()
    Indicates whether primary classes should be sorted before visiting.
    Returns:
      `true` if sorted input is required