Package org.codehaus.groovy.control
Class ProcessingUnit
java.lang.Object
org.codehaus.groovy.control.ProcessingUnit
- Direct Known Subclasses:
CompilationUnit
,SourceUnit
A base class for data structures that can collect messages and errors
during processing.
- Author:
- Chris Poirier
-
Field Summary
Modifier and TypeFieldDescriptionprotected GroovyClassLoader
The ClassLoader to use during processingprotected CompilerConfiguration
Configuration and other settings that control processingprotected ErrorCollector
a helper to share errors and report themprotected int
The current phaseprotected boolean
Set true if phase is finished -
Constructor Summary
ConstructorDescriptionProcessingUnit
(CompilerConfiguration configuration, GroovyClassLoader classLoader, ErrorCollector er) Initialize the ProcessingUnit to the empty state. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Marks the current phase complete and processes any errors.void
configure
(CompilerConfiguration configuration) Reconfigures the ProcessingUnit.Returns the class loader in use by this ProcessingUnit.Errors found during the compilation should be reported through the ErrorCollector.int
getPhase()
Returns the current phase.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
A synonym forgotoPhase( phase + 1 )
.void
setClassLoader
(GroovyClassLoader loader) Sets the class loader for use by this ProcessingUnit.void
setConfiguration
(CompilerConfiguration configuration)
-
Field Details
-
phase
protected int phaseThe current phase -
phaseComplete
protected boolean phaseCompleteSet true if phase is finished -
configuration
Configuration and other settings that control processing -
classLoader
The ClassLoader to use during processing -
errorCollector
a helper to share errors and report them
-
-
Constructor Details
-
ProcessingUnit
public ProcessingUnit(CompilerConfiguration configuration, GroovyClassLoader classLoader, ErrorCollector er) Initialize the ProcessingUnit to the empty state.
-
-
Method Details
-
configure
Reconfigures the ProcessingUnit. -
getConfiguration
-
setConfiguration
-
getClassLoader
Returns the class loader in use by this ProcessingUnit. -
setClassLoader
Sets the class loader for use by this ProcessingUnit. -
getPhase
public int getPhase()Returns the current phase. -
getPhaseDescription
Returns the description for the current phase. -
getErrorCollector
Errors found during the compilation should be reported through the ErrorCollector.- Returns:
- the ErrorCollector for this ProcessingUnit
-
completePhase
Marks the current phase complete and processes any errors.- Throws:
CompilationFailedException
-
nextPhase
A synonym forgotoPhase( phase + 1 )
.- Throws:
CompilationFailedException
-
gotoPhase
Wraps up any pending operations for the current phase and switches to the next phase.- Throws:
CompilationFailedException
-