You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by "Dick, Brian E." <Br...@FMR.com> on 2005/04/28 14:46:58 UTC

FilterSet vs FilterChains

<braindump>

There is a little overlap between FilterSet and FilterChain types, but
otherwise the two types are quite different.

For example the following two copy tasks are equivalent.

   <copy file="${src.file}" tofile="${dest.file}">
      <filterset>
         <filter token="DATE" value="${TODAY}"/>
      </filterset>
   </copy>

   <copy file="${src.file}" tofile="${dest.file}">
      <filterchain>
         <replacetokens>
            <token key="DATE" value="${TODAY}"/>
         </replacetokens>
      </filterchain>
   </copy>

The FilterSet type does token replacement. A FilterSet can be named and
referenced (reused) later. They also can be aggregated by using nesting.
In addition to the inline enumeration of token/value pairs, the
token/value pairs can be loaded from a file.

The FilterChain type can do a variety of different file transformations
in addition to simple token replacement. The documentation equates the
FilterChain type to Unix pipes. The supplied  nested elements provide
transformations for extracting Java class constants, escaping Unicode
characters, stripping comments, and many more. There is also an optional
filter that can execute an Apache BSF script. This makes the FilterChain
type easily extensible.

If the <replacetokens> element of the FilterChain type supported the
features of the FilterSet type (naming, nesting, file loading), the
FilterSet type would be obsolete.

</braindump>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org