Package org.apache.tools.ant.util
Class ScriptRunnerHelper
java.lang.Object
org.apache.tools.ant.util.ScriptRunnerHelper
A class to help in creating, setting and getting script runners.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(ResourceCollection resource) Add any source resource.voidAdd script text.Classpath to be used when searching for classes and resources.booleanGet the compilation feature.Get the external file encoding.Get the language.Create and set text on a script.getSrc()Get the external script file; optional.voidsetClassLoader(ClassLoader loader) Used when called by scriptdef.voidsetClasspath(Path classpath) Set the classpath to be used when searching for classes and resources.voidSet the classpath by reference.voidsetCompiled(boolean compiled) Enable the compilation of the script if possible.voidsetEncoding(String encoding) Set the encoding of the script from an external file; optional.voidsetLanguage(String language) Defines the language (required).voidsetManager(String manager) Deprecated.voidsetManager(ScriptManager manager) Set the manager.voidsetProjectComponent(ProjectComponent component) Set the project component associated with this helper.voidsetSetBeans(boolean setBeans) Set the setbeans attribute.voidLoad the script from an external file; optional.
-
Constructor Details
-
ScriptRunnerHelper
public ScriptRunnerHelper()
-
-
Method Details
-
setProjectComponent
Set the project component associated with this helper.- Parameters:
component- the project component that owns this helper.
-
getScriptRunner
Create and set text on a script.- Returns:
- the created or reused script runner.
-
createClasspath
Classpath to be used when searching for classes and resources.- Returns:
- an empty Path instance to be configured by Ant.
-
setClasspath
Set the classpath to be used when searching for classes and resources.- Parameters:
classpath- an Ant Path object containing the search path.
-
setClasspathRef
Set the classpath by reference.- Parameters:
r- a Reference to a Path instance to be used as the classpath value.
-
setSrc
Load the script from an external file; optional.- Parameters:
file- the file containing the script source.
-
getSrc
Get the external script file; optional.- Returns:
- the file containing the script source.
- Since:
- Ant 1.10.2
-
setEncoding
Set the encoding of the script from an external file; optional.- Parameters:
encoding- the encoding of the file containing the script source.- Since:
- Ant 1.10.2
-
getEncoding
Get the external file encoding.- Returns:
- the encoding of the file containing the script source.
- Since:
- Ant 1.10.2
-
addText
Add script text.- Parameters:
text- a component of the script text to be added.
-
setManager
Deprecated.Defines the script manager - defaults to "auto".- Parameters:
manager- the scripting manager - "bsf" or "javax" or "auto"
-
setManager
-
setLanguage
Defines the language (required).- Parameters:
language- the scripting language name for the script.
-
getLanguage
-
setCompiled
public void setCompiled(boolean compiled) Enable the compilation of the script if possible. If this is true and the compilation feature is available in the script engine, the script is compiled before the first evaluation, and should be cached for future evaluations. Otherwise, the script is evaluated each time. The default is false.- Parameters:
compiled- the value to set.
-
getCompiled
public boolean getCompiled()Get the compilation feature.- Returns:
- the compilation feature.
-
setSetBeans
public void setSetBeans(boolean setBeans) Set the setbeans attribute. If this is true, <script> will create variables in the script instance for all properties, targets and references of the current project. It this is false, only the project and self variables will be set. The default is true.- Parameters:
setBeans- the value to set.
-
setClassLoader
Used when called by scriptdef.- Parameters:
loader- the loader used by scriptdef.
-
add
Add any source resource.- Parameters:
resource- source of script- Since:
- Ant 1.7.1
-