DispatchTask (Apache Ant API)
Description: declaration: package: org.apache.tools.ant.dispatch, class: DispatchTask

Package org.apache.tools.ant.dispatch

# Class DispatchTask

java.lang.Object
org.apache.tools.ant.ProjectComponent
org.apache.tools.ant.Task
org.apache.tools.ant.dispatch.DispatchTask

All Implemented Interfaces:
  `Cloneable`, `Dispatchable`

Direct Known Subclasses:
  `Symlink`

public abstract class DispatchTask extends Task implements Dispatchable
Tasks extending this class may contain multiple actions. The method that is invoked for execution depends upon the value of the action attribute of the task.

Example:

<mytask action="list"/> will invoke the method with the signature public void list() in mytask's class. If the action attribute is not defined in the task or is empty, the execute() method will be called.

- ## 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
  `DispatchTask()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `String`
  `getAction()`
  Get the action.
  `String`
  `getActionParameterName()`
  Get the action parameter name.
  `void`
  `setAction(String action)`
  Set the action.

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

  `bindToOwner, execute, 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

  - ### DispatchTask

    public DispatchTask()

- ## Method Details

  - ### getActionParameterName

    public String getActionParameterName()
    Get the action parameter name.
    Specified by:
      `getActionParameterName` in interface `Dispatchable`
    Returns:
      the `String` "action" by default (can be overridden).

  - ### setAction

    public void setAction(String action)
    Set the action.
    Parameters:
      `action` - the method name.

  - ### getAction

    public String getAction()
    Get the action.
    Returns:
      the action.