Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
NullDataSqueezerFilter |
|
| 3.0;3 |
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 | ||
18 | /** | |
19 | * Handles null data assumedly? | |
20 | * | |
21 | * @author jcarman | |
22 | */ | |
23 | 0 | public class NullDataSqueezerFilter extends AbstractDataSqueezerFilter |
24 | { | |
25 | private static final String NULL_STRING = "X"; | |
26 | ||
27 | public String squeeze(Object data, DataSqueezer dataSqueezer) | |
28 | { | |
29 | 0 | if (data == null) |
30 | 0 | return NULL_STRING; |
31 | ||
32 | 0 | return dataSqueezer.squeeze(data); |
33 | } | |
34 | ||
35 | public Object unsqueeze(String string, DataSqueezer dataSqueezer) | |
36 | { | |
37 | 0 | if (NULL_STRING.equals(string)) |
38 | 0 | return null; |
39 | ||
40 | 0 | return dataSqueezer.unsqueeze(string); |
41 | } | |
42 | } |