public abstract class ProcessingUnit extends Object
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
True if phase is finished
|
Constructor and Description |
---|
ProcessingUnit(CompilerConfiguration configuration,
GroovyClassLoader classLoader,
ErrorCollector errorCollector)
Initializes the ProcessingUnit to the empty state.
|
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()
Get the CompilerConfiguration for this ProcessingUnit.
|
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 given phase.
|
boolean |
isPhaseComplete() |
void |
nextPhase()
A synonym for
gotoPhase(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.
|
protected int phase
protected boolean phaseComplete
protected CompilerConfiguration configuration
protected GroovyClassLoader classLoader
protected ErrorCollector errorCollector
public ProcessingUnit(CompilerConfiguration configuration, GroovyClassLoader classLoader, ErrorCollector errorCollector)
public void configure(CompilerConfiguration configuration)
public CompilerConfiguration getConfiguration()
public final void setConfiguration(CompilerConfiguration configuration)
public GroovyClassLoader getClassLoader()
public void setClassLoader(GroovyClassLoader loader)
public ErrorCollector getErrorCollector()
public int getPhase()
public String getPhaseDescription()
public boolean isPhaseComplete()
public void completePhase() throws CompilationFailedException
CompilationFailedException
public void nextPhase() throws CompilationFailedException
gotoPhase(getPhase() + 1)
.CompilationFailedException
public void gotoPhase(int phase) throws CompilationFailedException
CompilationFailedException