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 | 3 | 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 | 3 | if (data == null) |
30 | 1 | return NULL_STRING; |
31 | ||
32 | 2 | return dataSqueezer.squeeze(data); |
33 | } |
|
34 | ||
35 | public Object unsqueeze(String string, DataSqueezer dataSqueezer) |
|
36 | { |
|
37 | 1 | if (NULL_STRING.equals(string)) |
38 | 1 | return null; |
39 | ||
40 | 0 | return dataSqueezer.unsqueeze(string); |
41 | } |
|
42 | } |