Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
DataSqueezerFilter |
|
| 1.0;1 |
1 | // Copyright 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.services; | |
15 | ||
16 | /** | |
17 | * @author James Carman | |
18 | */ | |
19 | public interface DataSqueezerFilter { | |
20 | ||
21 | /** | |
22 | * Optionally squeezes the data object into a String. | |
23 | * | |
24 | * @param data the data to squeeze | |
25 | * @param dataSqueezer the next squeezer in the pipeline | |
26 | * | |
27 | * @return the string representation | |
28 | */ | |
29 | String squeeze(Object data, DataSqueezer dataSqueezer); | |
30 | ||
31 | /** | |
32 | * A convenience; invokes {@link #squeeze(Object, DataSqueezer)}for each element in the | |
33 | * data array. If data is null, returns null. | |
34 | * | |
35 | * @param data the data to squeeze | |
36 | * @param dataSqueezer the next squeezer in the pipeline | |
37 | * | |
38 | * @return the string representation | |
39 | */ | |
40 | String[] squeeze(Object[] data, DataSqueezer dataSqueezer); | |
41 | ||
42 | /** | |
43 | * Unsqueezes the string. Note that in a special case, where the first | |
44 | * character of the string is not a recognized prefix, it is assumed that | |
45 | * the string is simply a string, and returned with no change. | |
46 | * | |
47 | * @param string the string representation of the data | |
48 | * @param dataSqueezer the next squeezer in the pipeline | |
49 | * | |
50 | * @return the unsqueezed data object | |
51 | */ | |
52 | Object unsqueeze(String string, DataSqueezer dataSqueezer); | |
53 | ||
54 | /** | |
55 | * Convenience method for unsqueezing many strings (back into objects). | |
56 | * <p> | |
57 | * If strings is null, returns null. | |
58 | * </p> | |
59 | * @param strings the string representation of the data | |
60 | * @param dataSqueezer the next squeezer in the pipeline | |
61 | * | |
62 | * @return the unsqueezed data object | |
63 | */ | |
64 | Object[] unsqueeze(String[] strings, DataSqueezer dataSqueezer); | |
65 | } |