| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| BooleanTypeWrapper |
|
| 1.6666666666666667;1,667 |
| 1 | /* | |
| 2 | * Copyright 2008 - 2008 JEuclid, http://jeuclid.sf.net | |
| 3 | * | |
| 4 | * Licensed under the Apache 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.apache.org/licenses/LICENSE-2.0 | |
| 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 | ||
| 17 | /* $Id: BooleanTypeWrapper.java,v 03dc0884e86f 2008/06/21 10:53:35 maxberger $ */ | |
| 18 | ||
| 19 | package net.sourceforge.jeuclid.context.typewrapper; | |
| 20 | ||
| 21 | /** | |
| 22 | * Converting String to Boolean and vice versa is also straightforward. | |
| 23 | * | |
| 24 | * @version $Revision: 03dc0884e86f $ | |
| 25 | */ | |
| 26 | public final class BooleanTypeWrapper extends AbstractSimpleTypeWrapper { | |
| 27 | /** | |
| 28 | * | |
| 29 | */ | |
| 30 | private static final long serialVersionUID = 1L; | |
| 31 | ||
| 32 | 209 | private static final TypeWrapper INSTANCE = new BooleanTypeWrapper(); |
| 33 | ||
| 34 | /** Simple constructor. */ | |
| 35 | private BooleanTypeWrapper() { | |
| 36 | 209 | super(Boolean.class); |
| 37 | 209 | } |
| 38 | ||
| 39 | /** | |
| 40 | * @return the singleton instance. | |
| 41 | */ | |
| 42 | public static TypeWrapper getInstance() { | |
| 43 | 627 | return BooleanTypeWrapper.INSTANCE; |
| 44 | } | |
| 45 | ||
| 46 | /** {@inheritDoc} */ | |
| 47 | @Override | |
| 48 | public Object fromString(final String value) { | |
| 49 | 418 | if (value == null) { |
| 50 | 209 | return null; |
| 51 | } else { | |
| 52 | 209 | return Boolean.valueOf(value); |
| 53 | } | |
| 54 | } | |
| 55 | } |