org.apache.tools.ant.util

Class ScriptRunnerHelper

public class ScriptRunnerHelper extends Object

A class to help in creating, setting and getting script runners.
Method Summary
voidaddText(String text)
The script text.
PathcreateClasspath()
Classpath to be used when searching for classes and resources.
StringgetLanguage()
Get the language.
ScriptRunnerBasegetScriptRunner()
Create and set text on a script.
voidsetClassLoader(ClassLoader loader)
Used when called by scriptdef.
voidsetClasspath(Path classpath)
Set the classpath to be used when searching for classes and resources.
voidsetClasspathRef(Reference r)
Set the classpath by reference.
voidsetLanguage(String language)
Defines the language (required).
voidsetManager(String manager)
Defines the script manager - defaults to "auto".
voidsetProjectComponent(ProjectComponent component)
Set the project component associated with this helper.
voidsetSetBeans(boolean setBeans)
Set the setbeans attribute.
voidsetSrc(File file)
Load the script from an external file ; optional.

Method Detail

addText

public void addText(String text)
The script text.

Parameters: text a component of the script text to be added.

createClasspath

public Path createClasspath()
Classpath to be used when searching for classes and resources.

Returns: an empty Path instance to be configured by Ant.

getLanguage

public String getLanguage()
Get the language.

Returns: the scripting language.

getScriptRunner

public ScriptRunnerBase getScriptRunner()
Create and set text on a script.

Returns: the created or reused script runner.

setClassLoader

public void setClassLoader(ClassLoader loader)
Used when called by scriptdef.

Parameters: loader the loader used by scriptdef.

setClasspath

public void setClasspath(Path classpath)
Set the classpath to be used when searching for classes and resources.

Parameters: classpath an Ant Path object containing the search path.

setClasspathRef

public void setClasspathRef(Reference r)
Set the classpath by reference.

Parameters: r a Reference to a Path instance to be used as the classpath value.

setLanguage

public void setLanguage(String language)
Defines the language (required).

Parameters: language the scripting language name for the script.

setManager

public void setManager(String manager)
Defines the script manager - defaults to "auto".

Parameters: manager the scripting manager - "bsf" or "javax" or "auto"

setProjectComponent

public void setProjectComponent(ProjectComponent component)
Set the project component associated with this helper.

Parameters: component the project component that owns this helper.

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.

setSrc

public void setSrc(File file)
Load the script from an external file ; optional.

Parameters: file the file containing the script source.