|
Groovy 1.7.9 | |||||||
FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.codehaus.groovy.control.CompilerConfiguration
public class CompilerConfiguration extends Object
Compilation control flags and coordination stuff.
Field Summary | |
---|---|
static CompilerConfiguration |
DEFAULT
A convenience for getting a default configuration. |
static String |
POST_JDK5
This ( |
static String |
PRE_JDK5
This ( |
static String |
currentJVMVersion
|
Constructor Summary | |
CompilerConfiguration()
Sets the Flags to defaults. |
|
CompilerConfiguration(CompilerConfiguration configuration)
Copy constructor. |
|
CompilerConfiguration(Properties configuration)
Sets the Flags to the specified configuration, with defaults for those not supplied. |
Method Summary | |
---|---|
void
|
configure(Properties configuration)
Method to configure a this CompilerConfiguration by using Properties. |
List
|
getClasspath()
@return the classpath |
boolean
|
getDebug()
Returns true if debugging operation has been requested. |
String
|
getDefaultScriptExtension()
|
Map
|
getJointCompilationOptions()
Gets the joint compilation options for this configuration. |
int
|
getMinimumRecompilationInterval()
|
PrintWriter
|
getOutput()
Gets the currently configured output writer. |
ParserPluginFactory
|
getPluginFactory()
|
boolean
|
getRecompileGroovySource()
|
String
|
getScriptBaseClass()
Gets the name of the base class for scripts. |
Set
|
getScriptExtensions()
|
String
|
getSourceEncoding()
Gets the currently configured source file encoding. |
String
|
getTargetBytecode()
Retrieves the compiler bytecode compatibility mode. |
File
|
getTargetDirectory()
Gets the target directory for writing classes. |
int
|
getTolerance()
Returns the requested error tolerance. |
boolean
|
getVerbose()
Returns true if verbose operation has been requested. |
int
|
getWarningLevel()
Gets the currently configured warning level. |
void
|
setClasspath(String classpath)
Sets the classpath. |
void
|
setClasspathList(List l)
sets the classpath using a list of Strings |
void
|
setDebug(boolean debug)
Turns debugging operation on or off. |
void
|
setDefaultScriptExtension(String defaultScriptExtension)
|
void
|
setJointCompilationOptions(Map options)
Sets the joint compilation options for this configuration. |
void
|
setMinimumRecompilationInterval(int time)
|
void
|
setOutput(PrintWriter output)
Sets the output writer. |
void
|
setPluginFactory(ParserPluginFactory pluginFactory)
|
void
|
setRecompileGroovySource(boolean recompile)
|
void
|
setScriptBaseClass(String scriptBaseClass)
Sets the name of the base class for scripts. |
void
|
setScriptExtensions(Set scriptExtensions)
|
void
|
setSourceEncoding(String encoding)
Sets the encoding to be used when reading source files. |
void
|
setTargetBytecode(String version)
Allow setting the bytecode compatibility. |
void
|
setTargetDirectory(String directory)
Sets the target directory. |
void
|
setTargetDirectory(File directory)
Sets the target directory. |
void
|
setTolerance(int tolerance)
Sets the error tolerance, which is the number of non-fatal errors (per unit) that should be tolerated before compilation is aborted. |
void
|
setVerbose(boolean verbose)
Turns verbose operation on or off. |
void
|
setWarningLevel(int level)
Sets the warning level. |
Methods inherited from class Object | |
---|---|
wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll |
Field Detail |
---|
public static final CompilerConfiguration DEFAULT
new CompilerConfiguration()
.
public static final String POST_JDK5
"1.5"
) is the value for targetBytecode to compile for a JDK 1.5 or later JVM. *
public static final String PRE_JDK5
"1.4"
) is the value for targetBytecode to compile for a JDK 1.4 JVM. *
public static final 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(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 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 void configure(Properties configuration)
configuration
- The properties to get flag values from.
public List getClasspath()
public boolean getDebug()
public String getDefaultScriptExtension()
public Map getJointCompilationOptions()
public int getMinimumRecompilationInterval()
public PrintWriter getOutput()
public ParserPluginFactory getPluginFactory()
public boolean getRecompileGroovySource()
public String getScriptBaseClass()
public Set getScriptExtensions()
public String getSourceEncoding()
public String getTargetBytecode()
public File getTargetDirectory()
public int getTolerance()
public boolean getVerbose()
public int getWarningLevel()
public void setClasspath(String classpath)
public void setClasspathList(List l)
l
- list of strings containg the classpathparts
public void setDebug(boolean debug)
public void setDefaultScriptExtension(String defaultScriptExtension)
public void setJointCompilationOptions(Map options)
options
- the options
public void setMinimumRecompilationInterval(int time)
public void setOutput(PrintWriter output)
public void setPluginFactory(ParserPluginFactory pluginFactory)
public void setRecompileGroovySource(boolean recompile)
public void setScriptBaseClass(String scriptBaseClass)
public void setScriptExtensions(Set scriptExtensions)
public void setSourceEncoding(String encoding)
public void setTargetBytecode(String version)
version
- the bytecode compatibility mode
public void setTargetDirectory(String directory)
public void setTargetDirectory(File directory)
public void setTolerance(int tolerance)
public void setVerbose(boolean verbose)
public void setWarningLevel(int level)
Copyright © 2003-2010 The Codehaus. All rights reserved.