PropertyHelper

Since Ant 1.8.0

Description

This task is provided for the purpose of allowing the user to (a) install a different PropertyHelper at run time, or (b) (hopefully more often) install one or more PropertyHelper Delegates into the PropertyHelper active on the current Project. This is somewhat advanced Apache Ant usage and assumes a working familiarity with the modern Ant APIs. See the description of Ant's Property Helper for more information.

Parameters specified as nested elements

PropertyHelper

You may specify exactly one configured org.apache.tools.ant.PropertyHelper instance.

PropertyHelper.Delegate

You may specify, either in conjunction with a new PropertyHelper or not, one or more configured implementations of the org.apache.tools.ant.PropertyHelper.Delegate interface. A deeper understanding of the API is required here, however, as Delegate is a marker interface only: the nested arguments must implement a Delegate subinterface in order to do anything meaningful.

delegate

A generic <delegate> element which can use project references is also provided:

Parameters
Attribute Description Required
refid The id of a PropertyHelper.Delegate to install. Yes

Examples

Install a completely different PropertyHelper implementation (assuming MyPropertyHelper extends PropertyHelper):

<componentdef classname="org.example.MyPropertyHelper"
              name="mypropertyhelper"/>
<propertyhelper>
  <mypropertyhelper/>
</propertyhelper>

Add a new PropertyEvaluator delegate (assuming MyPropertyEvaluator implements PropertyHelper.PropertyEvaluator). Note that PropertyHelper uses the configured delegates in LIFO order. I.e. the delegate added by this task will be consulted before any previously defined delegate and in particular before the built-in ones.

<componentdef classname="org.example.MyPropertyEvaluator"
              name="mypropertyevaluator"/>
<propertyhelper>
  <mypropertyevaluator/>
</propertyhelper>

Add a new PropertyEvaluator delegate using the refid syntax:

<typedef classname="org.example.MyPropertyEvaluator"
         name="mypropertyevaluator"/>
<mypropertyevaluator id="evaluator"/>
<propertyhelper>
  <delegate refid="evaluator"/>
</propertyhelper>