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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Ant-contrib Tasks: SortList</title>
</head>
<body>
<h1>SortList</h1>
<p>Sort a delimited list of items in their natural string order. Note that
the <code>value</code> and <code>refid</code> attributes are mutually exclusive,
and the <code>value</code> attribute takes precedence if both are specified.</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">property</td>
<td valign="top">The name of the property to set.</td>
<td align="center" valign="top">Yes.</td>
</tr>
<tr>
<td valign="top">override</td>
<td valign="top">If the property is already set, should we change it's value.
Can be <code>true</code> or <code>false</code></td>
<td align="center" valign="top">No. Defaults to <code>false</code></td>
</tr>
<tr>
<td valign="top">value</td>
<td valign="top">The list of values to process, with the
delimiter character, indicated by the "delimiter"
attribute, separating each value.</td>
<td align="center" valign="top">Yes, unless "refid" is
specified.</td>
</tr>
<tr>
<td valign="top">refid</td>
<td valign="top">The id of where the list of values to sort is
stored.</td>
<td align="center" valign="top">Yes, unless "value" is
specified.</td>
</tr>
<tr>
<td valign="top">delimiter</td>
<td valign="top">The delimiter string that separates the
values in the "list" attribute.</td>
<td align="center" valign="top">No, defaults to ",".</td>
</tr>
<tr>
<td valign="top">casesensitive</td>
<td valign="top">If <code>true</code>, does a case sensitive sorting
of the strings. If <code>false</code> does case insensitive sorting.
</td>
<td align="center" valign="top">No. Defaults to true.</td>
</tr>
<tr>
<td valign="top">numeric</td>
<td valign="top">If <code>true</code>, does a numeric sorting, treating
all list entries as if they were numbers.
</td>
<td align="center" valign="top">No. Defaults to false.</td>
</tr>
<tr>
<td valign="top">orderPropertyFile</td>
<td valign="top">If specified, the list will sorted as if they were property
names, and will be sorted in the order those properties appear
in the given property file. Any properties in the
<code>value</code> attribute which do not appear in the properties file
will be inserted at the end of the list. This property is most useful
when used in conjunction with the <code><propertyselector></code>
task (see Example 2).
</td>
<td align="center" valign="top">No.</td>
</tr>
<tr>
<td valign="top">orderPropertyFilePrefix</td>
<td valign="top">If <code>orderPropertyFile</code> is specified, this
value (with a trailing '.') will be prefixed to each property in the
specified <code>orderPropertyFile</code> to determine sorting order
</td>
<td align="center" valign="top">No.</td>
</tr>
</table>
<hr />
<h2>Example 1</h2>
<pre>
<code>
<property name="my.list" value="z,y,x,w,v,u,t" />
<sortlist property="my.sorted.list" value="${my.list}"
delimiter="," />
<echo message="${my.sorted.list}" />
</code>
prints
<code>
[echo] t,u,v,w,x,y,z
</code>
<h2>Example 2</h2>
<pre>
test.properties
---------------
a.name=a
c.name=c
b.name=b
<code>
<property file="test.properties" prefix="test" />
<propertyselector property="my.list"
delimiter=","
match="test\..*\.name"
select="\0" />
<sortlist property="my.sorted.list"
value="${my.list}"
delimiter=","
orderPropertyFile="test.properties"
orderPropertyFilePrefix="test" />
<echo message="${my.sorted.list}" />
prints
<code>
[echo] test.a.name,test.c.name,test.b.name
</code>
Notice that the <code>test.properties</code> file did not have "test."
prefixing all the properties. The <code>orderPropertyFilePrefix</code> was
used to do that.
<hr>
<p align="center">Copyright © 2002-2003 Ant-Contrib Project. All
rights Reserved.</p>
</body>
</html>
|