Package org.codehaus.groovy.control
Class ProcessingUnit
java.lang.Object
org.codehaus.groovy.control.ProcessingUnit
- Direct Known Subclasses:
- CompilationUnit,- SourceUnit
public abstract class ProcessingUnit
extends java.lang.Object
A base class for data structures that can collect messages and errors
 during processing.
- 
Field SummaryFields Modifier and Type Field Description protected GroovyClassLoaderclassLoaderThe ClassLoader to use during processingprotected CompilerConfigurationconfigurationConfiguration and other settings that control processingprotected ErrorCollectorerrorCollectora helper to share errors and report themprotected intphaseThe current phaseprotected booleanphaseCompleteTrue if phase is finished
- 
Constructor SummaryConstructors Constructor Description ProcessingUnit(CompilerConfiguration configuration, GroovyClassLoader classLoader, ErrorCollector errorCollector)Initializes the ProcessingUnit to the empty state.
- 
Method SummaryModifier and Type Method Description voidcompletePhase()Marks the current phase complete and processes any errors.voidconfigure(CompilerConfiguration configuration)Reconfigures the ProcessingUnit.GroovyClassLoadergetClassLoader()Returns the class loader in use by this ProcessingUnit.CompilerConfigurationgetConfiguration()Gets the CompilerConfiguration for this ProcessingUnit.ErrorCollectorgetErrorCollector()Errors found during the compilation should be reported through the ErrorCollector.intgetPhase()Returns the current phase.java.lang.StringgetPhaseDescription()Returns the description for the current phase.voidgotoPhase(int phase)Wraps up any pending operations for the current phase and switches to the given phase.booleanisPhaseComplete()voidnextPhase()A synonym forgotoPhase(getPhase() + 1).voidsetClassLoader(GroovyClassLoader loader)Sets the class loader for use by this ProcessingUnit.voidsetConfiguration(CompilerConfiguration configuration)Sets the CompilerConfiguration for this ProcessingUnit.Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
- 
Field Details- 
phaseprotected int phaseThe current phase
- 
phaseCompleteprotected boolean phaseCompleteTrue if phase is finished
- 
configurationConfiguration and other settings that control processing
- 
classLoaderThe ClassLoader to use during processing
- 
errorCollectora helper to share errors and report them
 
- 
- 
Constructor Details- 
ProcessingUnitpublic ProcessingUnit(CompilerConfiguration configuration, GroovyClassLoader classLoader, ErrorCollector errorCollector)Initializes the ProcessingUnit to the empty state.
 
- 
- 
Method Details- 
configureReconfigures the ProcessingUnit.
- 
getConfigurationGets the CompilerConfiguration for this ProcessingUnit.
- 
setConfigurationSets the CompilerConfiguration for this ProcessingUnit.
- 
getClassLoaderReturns the class loader in use by this ProcessingUnit.
- 
setClassLoaderSets the class loader for use by this ProcessingUnit.
- 
getErrorCollectorErrors found during the compilation should be reported through the ErrorCollector.
- 
getPhasepublic int getPhase()Returns the current phase.
- 
getPhaseDescriptionpublic java.lang.String getPhaseDescription()Returns the description for the current phase.
- 
isPhaseCompletepublic boolean isPhaseComplete()
- 
completePhaseMarks the current phase complete and processes any errors.- Throws:
- CompilationFailedException
 
- 
nextPhaseA synonym forgotoPhase(getPhase() + 1).- Throws:
- CompilationFailedException
 
- 
gotoPhaseWraps up any pending operations for the current phase and switches to the given phase.- Throws:
- CompilationFailedException
 
 
-