ScriptDefBase (Apache Ant API)
Description: declaration: package: org.apache.tools.ant.taskdefs.optional.script, class: ScriptDefBase

Package org.apache.tools.ant.taskdefs.optional.script

# Class ScriptDefBase

java.lang.Object
org.apache.tools.ant.ProjectComponent
org.apache.tools.ant.Task
org.apache.tools.ant.taskdefs.optional.script.ScriptDefBase

All Implemented Interfaces:
  `Cloneable`, `DynamicAttribute`, `DynamicConfigurator`, `DynamicElement`

public class ScriptDefBase extends Task implements DynamicConfigurator
The script execution class. This class finds the defining script task and passes control to that task's executeScript method.

Since:
  Ant 1.6

- ## Field Summary

  ### Fields inherited from class org.apache.tools.ant.Task

  `target, taskName, taskType, wrapper`

  ### Fields inherited from class org.apache.tools.ant.ProjectComponent

  `description, location, project`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ScriptDefBase()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `addText(String text)`
  Set the script text.
  `Object`
  `createDynamicElement(String name)`
  Create a nested element
  `void`
  `execute()`
  Locate the script defining task and execute the script by passing control to it
  `void`
  `fail(String message)`
  Utility method for nested scripts; throws a BuildException with the given message.
  `String`
  `getText()`
  get the text of this element; may be null
  `void`
  `setDynamicAttribute(String name, String value)`
  Set a task attribute

  ### Methods inherited from class org.apache.tools.ant.Task

  `bindToOwner, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, log, log, maybeConfigure, perform, reconfigure, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType`

  ### Methods inherited from class org.apache.tools.ant.ProjectComponent

  `clone, getDescription, getLocation, getProject, setDescription, setLocation, setProject`

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

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

- ## Constructor Details

  - ### ScriptDefBase

    public ScriptDefBase()

- ## Method Details

  - ### execute

    public void execute()
    Locate the script defining task and execute the script by passing control to it
    Overrides:
      `execute` in class `Task`

  - ### createDynamicElement

    public Object createDynamicElement(String name)
    Create a nested element
    Specified by:
      `createDynamicElement` in interface `DynamicElement`
    Parameters:
      `name` - the nested element name
    Returns:
      the element to be configured

  - ### setDynamicAttribute

    public void setDynamicAttribute(String name, String value)
    Set a task attribute
    Specified by:
      `setDynamicAttribute` in interface `DynamicAttribute`
    Parameters:
      `name` - the attribute name.
      `value` - the attribute's string value

  - ### addText

    public void addText(String text)
    Set the script text.
    Parameters:
      `text` - a component of the script text to be added.
    Since:
      ant1.7

  - ### getText

    public String getText()
    get the text of this element; may be null
    Returns:
      text or null for no nested text
    Since:
      ant1.7

  - ### fail

    public void fail(String message)
    Utility method for nested scripts; throws a BuildException with the given message.
    Parameters:
      `message` - text to pass to the BuildException
    Throws:
      `BuildException` - always.
    Since:
      ant1.7