| <!-- |
| Licensed to the Apache Software Foundation (ASF) under one or more |
| contributor license agreements. See the NOTICE file distributed with |
| this work for additional information regarding copyright ownership. |
| The ASF licenses this file to You under the Apache License, Version 2.0 |
| (the "License"); you may not use this file except in compliance with |
| the License. You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
| --> |
| <html> |
| |
| <head> |
| <meta http-equiv="Content-Language" content="en-us"> |
| <link rel="stylesheet" type="text/css" href="../stylesheets/style.css"> |
| <title>PropertyHelper Task</title> |
| </head> |
| |
| <body> |
| |
| <h2>PropertyHelper</h2> |
| <h3>Description</h3> |
| <p>This task is provided for the purpose of allowing the user to |
| <b>(a)</b> install a different PropertyHelper at runtime, or |
| <b>(b)</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 |
| <a href="../properties.html#propertyHelper">Property Helper</a> for more information. |
| <b>Since Ant 1.8.0</b></p> |
| |
| <h3>Parameters specified as nested elements</h3> |
| |
| <h4>PropertyHelper</h4> |
| You may specify exactly one configured <code>org.apache.tools.ant.PropertyHelper</code> instance. |
| |
| <h4>PropertyHelper.Delegate</h4> |
| You may specify, either in conjunction with a new <code>PropertyHelper</code> or not, one or |
| more configured implementations of the <code>org.apache.tools.ant.PropertyHelper.Delegate</code> |
| interface. A deeper understanding of the API is required here, however, as <code>Delegate</code> |
| is a marker interface only: the nested arguments must implement a <code>Delegate</code> |
| subinterface in order to do anything meaningful. |
| |
| <h4>delegate</h4> |
| <p>A generic <delegate> element which can use project references |
| is also provided:</p> |
| |
| <h5>Parameters</h5> |
| <table border="1" cellpadding="2" cellspacing="0"> |
| <tr> |
| <td valign="top"><b>Attribute</b></td> |
| <td valign="top"><b>Description</b></td> |
| <td align="center" valign="top"><b>Required</b></td> |
| </tr> |
| <tr> |
| <td valign="top">refid</td> |
| <td valign="top">The <i>id</i> of a <code>PropertyHelper.Delegate</code> to install.</td> |
| <td valign="top" align="center">Yes</td> |
| </tr> |
| </table> |
| |
| <h3>Examples</h3> |
| |
| <p>Install a completely different PropertyHelper implementation |
| (assuming <code>MyPropertyHelper extends PropertyHelper</code>):</p> |
| |
| <pre> |
| <componentdef classname="org.example.MyPropertyHelper" |
| name="mypropertyhelper"/> |
| <propertyhelper> |
| <mypropertyhelper/> |
| </propertyhelper> |
| </pre> |
| |
| <p>Add a new PropertyEvaluator delegate |
| (assuming <code>MyPropertyEvaluator implements |
| PropertyHelper.PropertyEvaluator</code>). 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.</p> |
| |
| <pre> |
| <componentdef classname="org.example.MyPropertyEvaluator" |
| name="mypropertyevaluator"/> |
| <propertyhelper> |
| <mypropertyevaluator/> |
| </propertyhelper> |
| </pre> |
| |
| <p>Add a new PropertyEvaluator delegate using the refid syntax:</p> |
| |
| <pre> |
| <typedef classname="org.example.MyPropertyEvaluator" |
| name="mypropertyevaluator"/> |
| <mypropertyevaluator id="evaluator"/> |
| <propertyhelper> |
| <delegate refid="evaluator"/> |
| </propertyhelper> |
| </pre> |
| |
| </body> |
| </html> |
| |