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.ObjectA 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 SummaryAll Methods Instance Methods Concrete Methods Modifier 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()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)
 
- 
- 
- 
Field Detail- 
phaseprotected int phase The current phase
 - 
phaseCompleteprotected boolean phaseComplete True if phase is finished
 - 
configurationprotected CompilerConfiguration configuration Configuration and other settings that control processing
 - 
classLoaderprotected GroovyClassLoader classLoader The ClassLoader to use during processing
 - 
errorCollectorprotected ErrorCollector errorCollector a helper to share errors and report them
 
- 
 - 
Constructor Detail- 
ProcessingUnitpublic ProcessingUnit(CompilerConfiguration configuration, GroovyClassLoader classLoader, ErrorCollector errorCollector) Initializes the ProcessingUnit to the empty state.
 
- 
 - 
Method Detail- 
configurepublic void configure(CompilerConfiguration configuration) Reconfigures the ProcessingUnit.
 - 
getConfigurationpublic CompilerConfiguration getConfiguration() 
 - 
setConfigurationpublic final void setConfiguration(CompilerConfiguration configuration) 
 - 
getClassLoaderpublic GroovyClassLoader getClassLoader() Returns the class loader in use by this ProcessingUnit.
 - 
setClassLoaderpublic void setClassLoader(GroovyClassLoader loader) Sets the class loader for use by this ProcessingUnit.
 - 
getErrorCollectorpublic ErrorCollector getErrorCollector() Errors 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() 
 - 
completePhasepublic void completePhase() throws CompilationFailedExceptionMarks the current phase complete and processes any errors.- Throws:
- CompilationFailedException
 
 - 
nextPhasepublic void nextPhase() throws CompilationFailedExceptionA synonym forgotoPhase(getPhase() + 1).- Throws:
- CompilationFailedException
 
 - 
gotoPhasepublic void gotoPhase(int phase) throws CompilationFailedExceptionWraps up any pending operations for the current phase and switches to the given phase.- Throws:
- CompilationFailedException
 
 
- 
 
-