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 Summary
Fields Modifier and Type Field Description protected GroovyClassLoader
classLoader
The ClassLoader to use during processingprotected CompilerConfiguration
configuration
Configuration and other settings that control processingprotected ErrorCollector
errorCollector
a helper to share errors and report themprotected int
phase
The current phaseprotected boolean
phaseComplete
True if phase is finished -
Constructor Summary
Constructors Constructor Description ProcessingUnit(CompilerConfiguration configuration, GroovyClassLoader classLoader, ErrorCollector errorCollector)
Initializes the ProcessingUnit to the empty state. -
Method Summary
Modifier and Type Method 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()
Gets the CompilerConfiguration for this ProcessingUnit.ErrorCollector
getErrorCollector()
Errors found during the compilation should be reported through the ErrorCollector.int
getPhase()
Returns the current phase.java.lang.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 given phase.boolean
isPhaseComplete()
void
nextPhase()
A synonym forgotoPhase(getPhase() + 1)
.void
setClassLoader(GroovyClassLoader loader)
Sets the class loader for use by this ProcessingUnit.void
setConfiguration(CompilerConfiguration configuration)
Sets the CompilerConfiguration for this ProcessingUnit.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Field Details
-
phase
protected int phaseThe current phase -
phaseComplete
protected boolean phaseCompleteTrue 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 errorCollector)Initializes the ProcessingUnit to the empty state.
-
-
Method Details
-
configure
Reconfigures the ProcessingUnit. -
getConfiguration
Gets the CompilerConfiguration for this ProcessingUnit. -
setConfiguration
Sets the CompilerConfiguration for this ProcessingUnit. -
getClassLoader
Returns the class loader in use by this ProcessingUnit. -
setClassLoader
Sets the class loader for use by this ProcessingUnit. -
getErrorCollector
Errors found during the compilation should be reported through the ErrorCollector. -
getPhase
public int getPhase()Returns the current phase. -
getPhaseDescription
public java.lang.String getPhaseDescription()Returns the description for the current phase. -
isPhaseComplete
public boolean isPhaseComplete() -
completePhase
Marks the current phase complete and processes any errors.- Throws:
CompilationFailedException
-
nextPhase
A synonym forgotoPhase(getPhase() + 1)
.- Throws:
CompilationFailedException
-
gotoPhase
Wraps up any pending operations for the current phase and switches to the given phase.- Throws:
CompilationFailedException
-