org.codehaus.groovy.control

## Class ProcessingUnit

- java.lang.Object
- - org.codehaus.groovy.control.ProcessingUnit

- Direct Known Subclasses:
    CompilationUnit, SourceUnit

      public abstract class ProcessingUnit
      extends Object

  A base class for data structures that can collect messages and errors during processing.
  Version:
    $Id: ProcessingUnit.java 21284 2010-12-10 20:19:09Z hamletdrc $
  Author:
    Chris Poirier

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected GroovyClassLoader` | `classLoader` The ClassLoader to use during processing
    `protected CompilerConfiguration` | `configuration` Configuration and other settings that control processing
    `protected ErrorCollector` | `errorCollector` a helper to share errors and report them
    `protected int` | `phase` The current phase
    `protected boolean` | `phaseComplete` Set true if phase is finished

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ProcessingUnit(CompilerConfiguration configuration, GroovyClassLoader classLoader, ErrorCollector er)` Initialize the ProcessingUnit to the empty state.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `completePhase()` Marks the current phase complete and processes any errors.
    `void` | `configure(CompilerConfiguration configuration)` Reconfigures the ProcessingUnit.
    `GroovyClassLoader` | `getClassLoader()` Returns the class loader in use by this ProcessingUnit.
    `CompilerConfiguration` | `getConfiguration()`
    `ErrorCollector` | `getErrorCollector()` Errors found during the compilation should be reported through the ErrorCollector.
    `int` | `getPhase()` Returns the current phase.
    `String` | `getPhaseDescription()` Returns the description for the current phase.
    `void` | `gotoPhase(int phase)` Wraps up any pending operations for the current phase and switches to the next phase.
    `void` | `nextPhase()` A synonym for `gotoPhase( phase + 1 )`.
    `void` | `setClassLoader(GroovyClassLoader loader)` Sets the class loader for use by this ProcessingUnit.
    `void` | `setConfiguration(CompilerConfiguration configuration)`

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

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

- - ### Field Detail

    - #### phase

          protected int phase

      The current phase

    - #### phaseComplete

          protected boolean phaseComplete

      Set true if phase is finished

    - #### configuration

          protected CompilerConfiguration configuration

      Configuration and other settings that control processing

    - #### classLoader

          protected GroovyClassLoader classLoader

      The ClassLoader to use during processing

    - #### errorCollector

          protected ErrorCollector errorCollector

      a helper to share errors and report them

  - ### Constructor Detail

    - #### ProcessingUnit

          public ProcessingUnit(CompilerConfiguration configuration,
                        GroovyClassLoader classLoader,
                        ErrorCollector er)

      Initialize the ProcessingUnit to the empty state.

  - ### Method Detail

    - #### configure

          public void configure(CompilerConfiguration configuration)

      Reconfigures the ProcessingUnit.

    - #### getConfiguration

          public CompilerConfiguration getConfiguration()

    - #### setConfiguration

          public void setConfiguration(CompilerConfiguration configuration)

    - #### getClassLoader

          public GroovyClassLoader getClassLoader()

      Returns the class loader in use by this ProcessingUnit.

    - #### setClassLoader

          public void setClassLoader(GroovyClassLoader loader)

      Sets the class loader for use by this ProcessingUnit.

    - #### getPhase

          public int getPhase()

      Returns the current phase.

    - #### getPhaseDescription

          public String getPhaseDescription()

      Returns the description for the current phase.

    - #### getErrorCollector

          public ErrorCollector getErrorCollector()

      Errors found during the compilation should be reported through the ErrorCollector.
      Returns:
        the ErrorCollector for this ProcessingUnit

    - #### completePhase

          public void completePhase()
                             throws CompilationFailedException

      Marks the current phase complete and processes any errors.
      Throws:
        `CompilationFailedException`

    - #### nextPhase

          public void nextPhase()
                         throws CompilationFailedException

      A synonym for `gotoPhase( phase + 1 )`.
      Throws:
        `CompilationFailedException`

    - #### gotoPhase

          public void gotoPhase(int phase)
                         throws CompilationFailedException

      Wraps up any pending operations for the current phase and switches to the next phase.
      Throws:
        `CompilationFailedException`