| 1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> |
| 2 | <html> |
| 3 | <head> |
| 4 | <title>Ant-contrib Tasks: Switch</title> |
| 5 | </head> |
| 6 | |
| 7 | <body> |
| 8 | <h1>Switch</h1> |
| 9 | |
| 10 | <p>Task definition for the ANT task to switch on a particular value.</p> |
| 11 | |
| 12 | <h2>Parameters</h2> |
| 13 | <table border="1" cellpadding="2" cellspacing="0"> |
| 14 | <tr> |
| 15 | <th>Attribute</th> |
| 16 | <th>Description</th> |
| 17 | <th>Required</th> |
| 18 | </tr> |
| 19 | <tr> |
| 20 | <td valign="top">value</td> |
| 21 | <td valign="top">The value to switch on.</td> |
| 22 | <td align="center" valign="top">Yes.</td> |
| 23 | </tr> |
| 24 | <tr> |
| 25 | <td valign="top">caseinsensitive</td> |
| 26 | <td valign="top">Should we do case insensitive comparisons?</td> |
| 27 | <td align="center" valign="top">No, default is "false"</td> |
| 28 | </tr> |
| 29 | </table> |
| 30 | |
| 31 | <h2>Parameters specified as nested elements</h2> |
| 32 | |
| 33 | <p>At least one <code><case></code> or |
| 34 | <code><default></code> is required.</p> |
| 35 | |
| 36 | <h3>case</h3> |
| 37 | |
| 38 | <p>An individual case to consider, if the value that is being |
| 39 | switched on matches to value attribute of the case, then the |
| 40 | nested tasks will be executed.</p> |
| 41 | |
| 42 | <h4>Parameters</h4> |
| 43 | <table border="1" cellpadding="2" cellspacing="0"> |
| 44 | <tr> |
| 45 | <th>Attribute</th> |
| 46 | <th>Description</th> |
| 47 | <th>Required</th> |
| 48 | </tr> |
| 49 | <tr> |
| 50 | <td valign="top">value</td> |
| 51 | <td valign="top">The value to match against the tasks value attribute.</td> |
| 52 | <td align="center" valign="top">Yes.</td> |
| 53 | </tr> |
| 54 | </table> |
| 55 | |
| 56 | <h3>default</h3> |
| 57 | |
| 58 | <p>The default case for when no match is found. Must not appear |
| 59 | more than once per task.</p> |
| 60 | |
| 61 | <h2>Example</h2> |
| 62 | |
| 63 | <pre> |
| 64 | <switch value="${foo}"> |
| 65 | <case value="bar"> |
| 66 | <echo message="The value of property foo is bar" /> |
| 67 | </case> |
| 68 | <case value="baz"> |
| 69 | <echo message="The value of property foo is baz" /> |
| 70 | </case> |
| 71 | <default> |
| 72 | <echo message="The value of property foo is not sensible" /> |
| 73 | </default> |
| 74 | </switch> |
| 75 | </pre> |
| 76 | |
| 77 | <hr> |
| 78 | <p align="center">Copyright © 2002 Ant-Contrib Project. All |
| 79 | rights Reserved.</p> |
| 80 | |
| 81 | </body> |
| 82 | </html> |