## org.apache.tools.ant.types.optional
Class ScriptFilter

    java.lang.Object
      |
      +--org.apache.tools.ant.ProjectComponent
            |
            +--org.apache.tools.ant.filters.TokenFilter.ChainableReaderFilter
                  |
                  +--org.apache.tools.ant.types.optional.ScriptFilter

All Implemented Interfaces:
  ChainableReader, TokenFilter.Filter

public class ScriptFilter
extends TokenFilter.ChainableReaderFilter

Most of this is CAP (Cut And Paste) from the Script task ScriptFilter class, implements TokenFilter.Filter for scripts to use. This provides the same beans as the Script Task to a script. The script is meant to use get self.token and set self.token in the reply.

Since:
  Ant 1.6

Field Summary

Fields inherited from class org.apache.tools.ant.ProjectComponent
`project`

Constructor Summary
`ScriptFilter()`

Method Summary
`void` `addText(java.lang.String text)` The script text.
`java.lang.String` `filter(java.lang.String token)` Called filter the token.
`java.lang.String` `getToken()` The current token
`void` `setLanguage(java.lang.String language)` Defines the language (required).
`void` `setSrc(java.io.File file)` Load the script from an external file ; optional.
`void` `setToken(java.lang.String token)` The current token

Methods inherited from class org.apache.tools.ant.filters.TokenFilter.ChainableReaderFilter
`chain, setByLine`

Methods inherited from class org.apache.tools.ant.ProjectComponent
`getProject, log, log, setProject`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### ScriptFilter

    public ScriptFilter()

Method Detail

### setLanguage

    public void setLanguage(java.lang.String language)

  Defines the language (required).

  Parameters:
    `language` - the scripting language name for the script.

### setToken

    public void setToken(java.lang.String token)

  The current token

  Parameters:
    `token` - the string filtered by the script

### getToken

    public java.lang.String getToken()

  The current token

  Returns:
    the string filtered by the script

### filter

    public java.lang.String filter(java.lang.String token)

  Called filter the token. This sets the token in this object, calls the script and returns the token.

  Parameters:
    `token` - the token to be filtered
  Returns:
    the filtered token

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

  The script text.

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

Copyright © 2000-2004 Apache Software Foundation. All Rights Reserved.