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.8 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  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
  25. <b>(a)</b> install a different PropertyHelper at runtime, or
  26. <b>(b)</b> (hopefully more often) install one or more PropertyHelper Delegates into the
  27. PropertyHelper active on the current Project. This is somewhat advanced Ant usage and
  28. assumes a working familiarity with the modern Ant APIs. See the description of Ant's
  29. <a href="../properties.html#propertyHelper">Property Helper</a> for more information.
  30. <b>Since Ant 1.8.0</b></p>
  31. <h3>Parameters specified as nested elements</h3>
  32. <h4>PropertyHelper</h4>
  33. You may specify exactly one configured <code>org.apache.tools.ant.PropertyHelper</code> instance.
  34. <h4>PropertyHelper.Delegate</h4>
  35. You may specify, either in conjunction with a new <code>PropertyHelper</code> or not, one or
  36. more configured implementations of the <code>org.apache.tools.ant.PropertyHelper.Delegate</code>
  37. interface. A deeper understanding of the API is required here, however, as <code>Delegate</code>
  38. is a marker interface only: the nested arguments must implement a <code>Delegate</code>
  39. subinterface in order to do anything meaningful.
  40. <h4>delegate</h4>
  41. <p>A generic &lt;delegate&gt; element which can use project references
  42. is also provided:</p>
  43. <h5>Parameters</h5>
  44. <table border="1" cellpadding="2" cellspacing="0">
  45. <tr>
  46. <td valign="top"><b>Attribute</b></td>
  47. <td valign="top"><b>Description</b></td>
  48. <td align="center" valign="top"><b>Required</b></td>
  49. </tr>
  50. <tr>
  51. <td valign="top">refid</td>
  52. <td valign="top">The <i>id</i> of a <code>PropertyHelper.Delegate</code> to install.</td>
  53. <td valign="top" align="center">Yes</td>
  54. </tr>
  55. </table>
  56. <h3>Examples</h3>
  57. <p>Install a completely different PropertyHelper implementation
  58. (assuming <code>MyPropertyHelper extends PropertyHelper</code>):</p>
  59. <pre>
  60. &lt;componentdef classname="org.example.MyPropertyHelper"
  61. name="mypropertyhelper"/>
  62. &lt;propertyhelper>
  63. &lt;mypropertyhelper/>
  64. &lt;/propertyhelper>
  65. </pre>
  66. <p>Add a new PropertyEvaluator delegate
  67. (assuming <code>MyPropertyEvaluator implements
  68. PropertyHelper.PropertyEvaluator</code>). Note that PropertyHelper
  69. uses the configured delegates in LIFO order. I.e. the delegate
  70. added by this task will be consulted before any previously defined
  71. delegate and in particular before the built-in ones.</p>
  72. <pre>
  73. &lt;componentdef classname="org.example.MyPropertyEvaluator"
  74. name="mypropertyevaluator"/>
  75. &lt;propertyhelper>
  76. &lt;mypropertyevaluator/>
  77. &lt;/propertyhelper>
  78. </pre>
  79. <p>Add a new PropertyEvaluator delegate using the refid syntax:</p>
  80. <pre>
  81. &lt;typedef classname="org.example.MyPropertyEvaluator"
  82. name="mypropertyevaluator"/>
  83. &lt;mypropertyevaluator id="evaluator"/>
  84. &lt;propertyhelper>
  85. &lt;delegate refid="evaluator"/>
  86. &lt;/propertyhelper>
  87. </pre>
  88. </body>
  89. </html>