| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| NoOpStringFormatter |
|
| 1.4285714285714286;1.429 |
| 1 | /* | |
| 2 | * Copyright 2006-2008 The Kuali Foundation | |
| 3 | * | |
| 4 | * Licensed under the Educational Community License, Version 2.0 (the "License"); | |
| 5 | * you may not use this file except in compliance with the License. | |
| 6 | * You may obtain a copy of the License at | |
| 7 | * | |
| 8 | * http://www.opensource.org/licenses/ecl2.php | |
| 9 | * | |
| 10 | * Unless required by applicable law or agreed to in writing, software | |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, | |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| 13 | * See the License for the specific language governing permissions and | |
| 14 | * limitations under the License. | |
| 15 | */ | |
| 16 | package org.kuali.rice.kns.web.format; | |
| 17 | ||
| 18 | import java.util.Collection; | |
| 19 | ||
| 20 | ||
| 21 | /** | |
| 22 | * This class is used to prevent reformatting of String values. | |
| 23 | */ | |
| 24 | 0 | public class NoOpStringFormatter extends Formatter { |
| 25 | /** | |
| 26 | * Does absolutely nothing to the given String. Yes, this is actually a valuable way to prevent the POJO stuff from converting a | |
| 27 | * simple String into a 1-element String array. | |
| 28 | */ | |
| 29 | protected Object convertToObject(String target) { | |
| 30 | 0 | return target; |
| 31 | } | |
| 32 | ||
| 33 | /** | |
| 34 | * Does absolutely nothing to the given String. Yes, this is actually a valuable way to prevent the POJO stuff from converting a | |
| 35 | * simple String into a 1-element String array. | |
| 36 | */ | |
| 37 | public Object format(Object value) { | |
| 38 | 0 | if (value != null) { |
| 39 | 0 | if (!(value instanceof String)) { |
| 40 | 0 | throw new FormatException("the given " + value.getClass().getName() + " value is not a String"); |
| 41 | } | |
| 42 | } | |
| 43 | ||
| 44 | 0 | return value; |
| 45 | } | |
| 46 | ||
| 47 | public Object convertFromPresentationFormat(Object value) { | |
| 48 | 0 | return super.convertFromPresentationFormat(value); |
| 49 | } | |
| 50 | ||
| 51 | public Object formatArray(Object value) { | |
| 52 | 0 | return super.formatArray(value); |
| 53 | } | |
| 54 | ||
| 55 | public Object formatCollection(Collection value) { | |
| 56 | 0 | return super.formatCollection(value); |
| 57 | } | |
| 58 | ||
| 59 | public Object formatForPresentation(Object value) { | |
| 60 | 0 | return super.formatForPresentation(value); |
| 61 | } | |
| 62 | ||
| 63 | public Object formatObject(Object value) { | |
| 64 | 0 | return super.formatObject(value); |
| 65 | } | |
| 66 | } |