Debian Codegraph @

manual/Tasks/propertyhelper.html

raw
1 <!DOCTYPE html>
2 <!--
3 Licensed to the Apache Software Foundation (ASF) under one or more
4 contributor license agreements. See the NOTICE file distributed with
5 this work for additional information regarding copyright ownership.
6 The ASF licenses this file to You under the Apache License, Version 2.0
7 (the "License"); you may not use this file except in compliance with
8 the License. You may obtain a copy of the License at
9
10 https://www.apache.org/licenses/LICENSE-2.0
11
12 Unless required by applicable law or agreed to in writing, software
13 distributed under the License is distributed on an "AS IS" BASIS,
14 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 See the License for the specific language governing permissions and
16 limitations under the License.
17 -->
18 <html lang="en">
19
20 <head>
21 <link rel="stylesheet" type="text/css" href="../stylesheets/style.css">
22 <title>PropertyHelper Task</title>
23 </head>
24
25 <body>
26
27 <h2>PropertyHelper</h2>
28 <p><em>Since Ant 1.8.0</em></p>
29 <h3>Description</h3>
30 <p>This task is provided for the purpose of allowing the user to <strong>(a)</strong> install a
31 different <code>PropertyHelper</code> at run time, or <strong>(b)</strong> (hopefully more often)
32 install one or more <code class="code">PropertyHelper</code> Delegates into
33 the <code class="code">PropertyHelper</code> active on the
34 current <code class="code">Project</code>. This is somewhat advanced Apache Ant usage and assumes a
35 working familiarity with the modern Ant APIs. See the description of
36 Ant's <a href="../properties.html#propertyHelper">Property Helper</a> for more information.</p>
37
38 <h3>Parameters specified as nested elements</h3>
39
40 <h4>PropertyHelper</h4>
41 <p>You may specify exactly one configured <code>org.apache.tools.ant.PropertyHelper</code>
42 instance.</p>
43
44 <h4>PropertyHelper.Delegate</h4>
45 <p>You may specify, either in conjunction with a new <code class="code">PropertyHelper</code> or
46 not, one or more configured implementations of
47 the <code class="code">org.apache.tools.ant.PropertyHelper.Delegate</code> interface. A deeper
48 understanding of the API is required here, however, as <code class="code">Delegate</code> is a
49 marker interface only: the nested arguments must implement a <code class="code">Delegate</code>
50 subinterface in order to do anything meaningful.</p>
51
52 <h4>delegate</h4>
53 <p>A generic <code>&lt;delegate&gt;</code> element which can use project references is also
54 provided:</p>
55
56 <h5>Parameters</h5>
57 <table class="attr">
58 <tr>
59 <th scope="col">Attribute</th>
60 <th scope="col">Description</th>
61 <th scope="col">Required</th>
62 </tr>
63 <tr>
64 <td>refid</td>
65 <td>The <var>id</var> of a <code>PropertyHelper.Delegate</code> to install.</td>
66 <td>Yes</td>
67 </tr>
68 </table>
69
70 <h3>Examples</h3>
71
72 <p>Install a completely different <code class="code">PropertyHelper</code> implementation
73 (assuming <code class="code">MyPropertyHelper extends PropertyHelper</code>):</p>
74
75 <pre>
76 &lt;componentdef classname="org.example.MyPropertyHelper"
77 name="mypropertyhelper"/>
78 &lt;propertyhelper>
79 &lt;mypropertyhelper/>
80 &lt;/propertyhelper>
81 </pre>
82
83 <p>Add a new <code class="code">PropertyEvaluator</code> delegate
84 (assuming <code class="code">MyPropertyEvaluator implements
85 PropertyHelper.PropertyEvaluator</code>). Note that <code class="code">PropertyHelper</code> uses
86 the configured delegates in LIFO order. I.e. the delegate added by this task will be consulted
87 before any previously defined delegate and in particular before the built-in ones.</p>
88
89 <pre>
90 &lt;componentdef classname="org.example.MyPropertyEvaluator"
91 name="mypropertyevaluator"/>
92 &lt;propertyhelper>
93 &lt;mypropertyevaluator/>
94 &lt;/propertyhelper>
95 </pre>
96
97 <p>Add a new <code class="code">PropertyEvaluator</code> delegate using the <var>refid</var>
98 syntax:</p>
99
100 <pre>
101 &lt;typedef classname="org.example.MyPropertyEvaluator"
102 name="mypropertyevaluator"/>
103 &lt;mypropertyevaluator id="evaluator"/>
104 &lt;propertyhelper>
105 &lt;delegate refid="evaluator"/>
106 &lt;/propertyhelper>
107 </pre>
108
109 </body>
110 </html>