summaryrefslogtreecommitdiffstats
path: root/docs/manual/tasks/switch.html
blob: 837c70167d7d898da2578175bf346aa355292af7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>Ant-contrib Tasks: Switch</title>
  </head>

  <body>
    <h1>Switch</h1>

    <p>Task definition for the ANT task to switch on a particular value.</p>

    <h2>Parameters</h2>
    <table border="1" cellpadding="2" cellspacing="0">
      <tr>
        <th>Attribute</th>
        <th>Description</th>
        <th>Required</th>
      </tr>
      <tr>
        <td valign="top">value</td>
        <td valign="top">The value to switch on.</td>
        <td align="center" valign="top">Yes.</td>
      </tr>
      <tr>
        <td valign="top">caseinsensitive</td>
        <td valign="top">Should we do case insensitive comparisons?</td>
        <td align="center" valign="top">No, default is &quot;false&quot;</td>
      </tr>
    </table>

    <h2>Parameters specified as nested elements</h2>

    <p>At least one <code>&lt;case&gt;</code> or
    <code>&lt;default&gt;</code> is required.</p>

    <h3>case</h3>

    <p>An individual case to consider, if the value that is being
    switched on matches to value attribute of the case, then the
    nested tasks will be executed.</p>

    <h4>Parameters</h4>
    <table border="1" cellpadding="2" cellspacing="0">
      <tr>
        <th>Attribute</th>
        <th>Description</th>
        <th>Required</th>
      </tr>
      <tr>
        <td valign="top">value</td>
        <td valign="top">The value to match against the tasks value attribute.</td>
        <td align="center" valign="top">Yes.</td>
      </tr>
    </table>

    <h3>default</h3>

    <p>The default case for when no match is found.  Must not appear
    more than once per task.</p>

    <h2>Example</h2>

<pre>
&lt;switch value=&quot;${foo}&quot;&gt;
  &lt;case value=&quot;bar&quot;&gt;
    &lt;echo message=&quot;The value of property foo is bar&quot; /&gt;
  &lt;/case&gt;
  &lt;case value=&quot;baz&quot;&gt;
    &lt;echo message=&quot;The value of property foo is baz&quot; /&gt;
  &lt;/case&gt;
  &lt;default&gt;
    &lt;echo message=&quot;The value of property foo is not sensible&quot; /&gt;
  &lt;/default&gt;
&lt;/switch&gt;
</pre>

    <hr>
    <p align="center">Copyright &copy; 2002 Ant-Contrib Project. All
    rights Reserved.</p>

  </body>
</html>