Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
AbstractDataSqueezerFilter |
|
| 2.0;2 |
1 | // Copyright May 31, 2006 The Apache Software Foundation | |
2 | // | |
3 | // Licensed under the Apache License, Version 2.0 (the "License"); | |
4 | // you may not use this file except in compliance with the License. | |
5 | // You may obtain a copy of the License at | |
6 | // | |
7 | // http://www.apache.org/licenses/LICENSE-2.0 | |
8 | // | |
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 | package org.apache.tapestry.data; | |
15 | ||
16 | import org.apache.tapestry.services.DataSqueezer; | |
17 | import org.apache.tapestry.services.DataSqueezerFilter; | |
18 | ||
19 | ||
20 | /** | |
21 | * A useful superclass for data squeezer filters. Subclasses only have | |
22 | * to implement the single object versions of the squeeze/unsqueeze methods. | |
23 | * | |
24 | * @author jcarman | |
25 | */ | |
26 | 0 | public abstract class AbstractDataSqueezerFilter implements DataSqueezerFilter |
27 | { | |
28 | ||
29 | /** | |
30 | * Merely calls squeeze(Object,DataSqueezer) on each object in | |
31 | * the array. | |
32 | */ | |
33 | public String[] squeeze( Object[] objects, DataSqueezer next ) | |
34 | { | |
35 | 0 | final String[] squeezed = new String[objects.length]; |
36 | ||
37 | 0 | for( int i = 0; i < squeezed.length; i++ ) { |
38 | ||
39 | 0 | squeezed[i] = squeeze( objects[i], next ); |
40 | } | |
41 | ||
42 | 0 | return squeezed; |
43 | } | |
44 | ||
45 | /** | |
46 | * Merely calls unsqueeze(String,DataSqueezer) on each object in | |
47 | * the array. | |
48 | */ | |
49 | public Object[] unsqueeze( String[] strings, DataSqueezer next ) | |
50 | { | |
51 | 0 | final Object[] unsqueezed = new Object[strings.length]; |
52 | ||
53 | 0 | for( int i = 0; i < unsqueezed.length; i++ ) { |
54 | ||
55 | 0 | unsqueezed[i] = unsqueeze( strings[i], next ); |
56 | } | |
57 | ||
58 | 0 | return unsqueezed; |
59 | } | |
60 | } |