Differences between revisions 2 and 3
Revision 2 as of 2005-03-22 05:42:42
Size: 1302
Editor: anonymous
Comment: missing edit-log entry for this revision
Revision 3 as of 2009-09-20 22:08:00
Size: 1306
Editor: localhost
Comment: converted to 1.6 markup
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
Tasks and data-types can now accept arbitrary classes that implement a certain interface or extend a certain class as nested elements by using `add(Type)` as the adder method. Details can be found [http://ant.apache.org/manual/develop.html#nestedtype here]. Tasks and data-types can now accept arbitrary classes that implement a certain interface or extend a certain class as nested elements by using `add(Type)` as the adder method. Details can be found [[http://ant.apache.org/manual/develop.html#nestedtype|here]].
Line 3: Line 3:
Some of the built-in tasks/types have been enhanced with interface adders of that kind, you can now add a new condtion by <typedef>ing the class (to give it a name) and nesting it into the <condition> task. The same is possible for selectors and filterreaders, it is described in more detail [http://ant.apache.org/manual/CoreTypes/custom-programming.html here]. Some of the built-in tasks/types have been enhanced with interface adders of that kind, you can now add a new condtion by <typedef>ing the class (to give it a name) and nesting it into the <condition> task. The same is possible for selectors and filterreaders, it is described in more detail [[http://ant.apache.org/manual/CoreTypes/custom-programming.html|here]].

Tasks and data-types can now accept arbitrary classes that implement a certain interface or extend a certain class as nested elements by using add(Type) as the adder method. Details can be found here.

Some of the built-in tasks/types have been enhanced with interface adders of that kind, you can now add a new condtion by <typedef>ing the class (to give it a name) and nesting it into the <condition> task. The same is possible for selectors and filterreaders, it is described in more detail here.

The short version looks like this

Define a condition that checks whether a given value ends with FOO.

  package org.example;
  import org.apache.tools.ant.taskdefs.condition.Condition;

  public class EndsWithFoo implements Condition {
      private String value;

      public void setValue(String value) {
          this.value = value;
      }

      public boolean eval() {
          return value.endsWith("FOO");
      }
  }

name it

  <typedef name="endswithfoo" classname="org.example.EndsWithFoo"/>

and simply use it

  <condition property="fooEndsWithFoo">
    <endswithfoo value="foo"/>
  </condition>

NewAntFeaturesInDetail/NewIntrospectionRules (last edited 2009-09-20 22:08:00 by localhost)