You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

propertyhelper.html 3.9 kB

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