|
Groovy Documentation | |||||||
FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.codehaus.groovy.control.CompilerConfiguration
public class CompilerConfiguration extends java.lang.Object
Compilation control flags and coordination stuff.
Field Summary | |
---|---|
static CompilerConfiguration |
DEFAULT
A convenience for getting a default configuration. |
static java.lang.String |
POST_JDK5
This ( |
static java.lang.String |
PRE_JDK5
This ( |
static java.lang.String |
currentJVMVersion
|
Constructor Summary | |
CompilerConfiguration()
|
|
CompilerConfiguration(CompilerConfiguration configuration)
Copy constructor. |
|
CompilerConfiguration(java.util.Properties configuration)
Sets the Flags to the specified configuration, with defaults for those not supplied. |
Method Summary | |
---|---|
CompilerConfiguration
|
addCompilationCustomizers(CompilationCustomizer... customizers)
|
void
|
configure(java.util.Properties configuration)
|
java.util.List
|
getClasspath()
Returns true if debugging operation has been requested. |
java.util.List
|
getCompilationCustomizers()
|
boolean
|
getDebug()
Sets the name of the base class for scripts. |
java.lang.String
|
getDefaultScriptExtension()
|
java.util.Set
|
getDisabledGlobalASTTransformations()
|
java.util.Map
|
getJointCompilationOptions()
Adds compilation customizers to the compilation process. |
int
|
getMinimumRecompilationInterval()
|
java.util.Map
|
getOptimizationOptions()
Returns the list of disabled global AST transformation class names. |
java.io.PrintWriter
|
getOutput()
Sets the target directory. |
ParserPluginFactory
|
getPluginFactory()
|
boolean
|
getRecompileGroovySource()
|
java.lang.String
|
getScriptBaseClass()
|
java.util.Set
|
getScriptExtensions()
|
java.lang.String
|
getSourceEncoding()
Gets the target directory for writing classes. |
java.lang.String
|
getTargetBytecode()
Gets the optimization options for this configuration. |
java.io.File
|
getTargetDirectory()
Sets the classpath. |
int
|
getTolerance()
|
boolean
|
getVerbose()
|
int
|
getWarningLevel()
Gets the currently configured warning level. |
void
|
setClasspath(java.lang.String classpath)
Turns debugging operation on or off. |
void
|
setClasspathList(java.util.List parts)
Returns the requested error tolerance. |
void
|
setDebug(boolean debug)
|
void
|
setDefaultScriptExtension(java.lang.String defaultScriptExtension)
|
void
|
setDisabledGlobalASTTransformations(java.util.Set disabledGlobalASTTransformations)
|
void
|
setJointCompilationOptions(java.util.Map options)
Returns the list of compilation customizers. |
void
|
setMinimumRecompilationInterval(int time)
|
void
|
setOptimizationOptions(java.util.Map options)
|
void
|
setOutput(java.io.PrintWriter output)
@return the classpath |
void
|
setPluginFactory(ParserPluginFactory pluginFactory)
|
void
|
setRecompileGroovySource(boolean recompile)
|
void
|
setScriptBaseClass(java.lang.String scriptBaseClass)
|
void
|
setScriptExtensions(java.util.Set scriptExtensions)
|
void
|
setSourceEncoding(java.lang.String encoding)
|
void
|
setTargetBytecode(java.lang.String version)
Sets the joint compilation options for this configuration. |
void
|
setTargetDirectory(java.lang.String directory)
|
void
|
setTargetDirectory(java.io.File directory)
Returns true if verbose operation has been requested. |
void
|
setTolerance(int tolerance)
|
void
|
setVerbose(boolean verbose)
Gets the name of the base class for scripts. |
void
|
setWarningLevel(int level)
|
Methods inherited from class java.lang.Object | |
---|---|
java.lang.Object#wait(long, int), java.lang.Object#wait(long), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll() |
Field Detail |
---|
public static final CompilerConfiguration DEFAULT
new CompilerConfiguration()
.
public static final java.lang.String POST_JDK5
"1.5"
) is the value for targetBytecode to compile for a JDK 1.5 or later JVM. *
public static final java.lang.String PRE_JDK5
"1.4"
) is the value for targetBytecode to compile for a JDK 1.4 JVM. *
public static final java.lang.String currentJVMVersion
Constructor Detail |
---|
public CompilerConfiguration()
public CompilerConfiguration(CompilerConfiguration configuration)
// In all likelihood there is already a configuration in your code's context // for you to copy, but for the sake of this example we'll use the global default. CompilerConfiguration myConfiguration = new CompilerConfiguration(CompilerConfiguration.DEFAULT); myConfiguration.setDebug(true);
configuration
- The configuration to copy.
public CompilerConfiguration(java.util.Properties configuration)
System.getProperties()
(which
is done using this constructor).Properties myProperties = new Properties(System.getProperties()); myProperties.setProperty("groovy.output.debug", "true"); myConfiguration = new CompilerConfiguration(myProperties);And you also have to contend with a possible SecurityException when getting the system properties (See java.lang.System#getProperties()).
// In all likelihood there is already a configuration for you to copy, // but for the sake of this example we'll use the global default. CompilerConfiguration myConfiguration = new CompilerConfiguration(CompilerConfiguration.DEFAULT); myConfiguration.setDebug(true);Another reason to use the copy constructor rather than this one is that you must call setOutput. Calling
setOutput(null)
is valid and will
set up a PrintWriter
to a bit bucket. The copy constructor will of course set
the same one as the original.
Property Key | Get/Set Property Name |
---|---|
"groovy.warnings" | getWarningLevel |
"groovy.source.encoding" | getSourceEncoding |
"groovy.target.directory" | getTargetDirectory |
"groovy.target.bytecode" | getTargetBytecode |
"groovy.classpath" | getClasspath |
"groovy.output.verbose" | getVerbose |
"groovy.output.debug" | getDebug |
"groovy.errors.tolerance" | getTolerance |
"groovy.script.extension" | getDefaultScriptExtension |
"groovy.script.base" | getScriptBaseClass |
"groovy.recompile" | getRecompileGroovySource |
"groovy.recompile.minimumInterval" | getMinimumRecompilationInterval |
configuration
- The properties to get flag values from.
Method Detail |
---|
public CompilerConfiguration addCompilationCustomizers(CompilationCustomizer... customizers)
public void configure(java.util.Properties configuration)
public java.util.List getClasspath()
public java.util.List getCompilationCustomizers()
public boolean getDebug()
public java.lang.String getDefaultScriptExtension()
public java.util.Set getDisabledGlobalASTTransformations()
public java.util.Map getJointCompilationOptions()
customizers
- the list of customizers to be added
public int getMinimumRecompilationInterval()
public java.util.Map getOptimizationOptions()
public java.io.PrintWriter getOutput()
public ParserPluginFactory getPluginFactory()
public boolean getRecompileGroovySource()
public java.lang.String getScriptBaseClass()
public java.util.Set getScriptExtensions()
public java.lang.String getSourceEncoding()
public java.lang.String getTargetBytecode()
public java.io.File getTargetDirectory()
public int getTolerance()
public boolean getVerbose()
public int getWarningLevel()
public void setClasspath(java.lang.String classpath)
public void setClasspathList(java.util.List parts)
public void setDebug(boolean debug)
public void setDefaultScriptExtension(java.lang.String defaultScriptExtension)
public void setDisabledGlobalASTTransformations(java.util.Set disabledGlobalASTTransformations)
public void setJointCompilationOptions(java.util.Map options)
public void setMinimumRecompilationInterval(int time)
public void setOptimizationOptions(java.util.Map options)
public void setOutput(java.io.PrintWriter output)
public void setPluginFactory(ParserPluginFactory pluginFactory)
public void setRecompileGroovySource(boolean recompile)
public void setScriptBaseClass(java.lang.String scriptBaseClass)
public void setScriptExtensions(java.util.Set scriptExtensions)
public void setSourceEncoding(java.lang.String encoding)
public void setTargetBytecode(java.lang.String version)
options
- the options
public void setTargetDirectory(java.lang.String directory)
public void setTargetDirectory(java.io.File directory)
public void setTolerance(int tolerance)
public void setVerbose(boolean verbose)
public void setWarningLevel(int level)
Groovy Documentation