ScriptRunnerHelper (Apache Ant API)
Date: 2021-07-10

org.apache.tools.ant.util

## Class ScriptRunnerHelper

- java.lang.Object
- - org.apache.tools.ant.util.ScriptRunnerHelper

-     public class ScriptRunnerHelper
      extends java.lang.Object

  A class to help in creating, setting and getting script runners.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ScriptRunnerHelper()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `add(ResourceCollection resource)` Add any source resource.
    `void` | `addText(java.lang.String text)` Add script text.
    `Path` | `createClasspath()` Classpath to be used when searching for classes and resources.
    `java.lang.String` | `getLanguage()` Get the language.
    `ScriptRunnerBase` | `getScriptRunner()` Create and set text on a script.
    `void` | `setClassLoader(java.lang.ClassLoader loader)` Used when called by scriptdef.
    `void` | `setClasspath(Path classpath)` Set the classpath to be used when searching for classes and resources.
    `void` | `setClasspathRef(Reference r)` Set the classpath by reference.
    `void` | `setLanguage(java.lang.String language)` Defines the language (required).
    `void` | `setManager(java.lang.String manager)` Defines the script manager - defaults to "auto".
    `void` | `setProjectComponent(ProjectComponent component)` Set the project component associated with this helper.
    `void` | `setSetBeans(boolean setBeans)` Set the setbeans attribute.
    `void` | `setSrc(java.io.File file)` Load the script from an external file; optional.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### ScriptRunnerHelper

          public ScriptRunnerHelper()

  - ### Method Detail

    - #### setProjectComponent

          public void setProjectComponent(ProjectComponent component)

      Set the project component associated with this helper.
      Parameters:
        `component` - the project component that owns this helper.

    - #### getScriptRunner

          public ScriptRunnerBase getScriptRunner()

      Create and set text on a script.
      Returns:
        the created or reused script runner.

    - #### createClasspath

          public Path createClasspath()

      Classpath to be used when searching for classes and resources.
      Returns:
        an empty Path instance to be configured by Ant.

    - #### 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.

    - #### setSrc

          public void setSrc(java.io.File file)

      Load the script from an external file; optional.
      Parameters:
        `file` - the file containing the script source.

    - #### addText

          public void addText(java.lang.String text)

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

    - #### setManager

          public void setManager(java.lang.String manager)

      Defines the script manager - defaults to "auto".
      Parameters:
        `manager` - the scripting manager - "bsf" or "javax" or "auto"

    - #### setLanguage

          public void setLanguage(java.lang.String language)

      Defines the language (required).
      Parameters:
        `language` - the scripting language name for the script.

    - #### getLanguage

          public java.lang.String getLanguage()

      Get the language.
      Returns:
        the scripting language.

    - #### 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

          public void setClassLoader(java.lang.ClassLoader loader)

      Used when called by scriptdef.
      Parameters:
        `loader` - the loader used by scriptdef.

    - #### add

          public void add(ResourceCollection resource)

      Add any source resource.
      Parameters:
        `resource` - source of script
      Since:
        Ant 1.7.1