| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| AbstractPrimitiveMorpher |
|
| 1.0;1 |
| 1 | /* | |
| 2 | * Copyright 2006-2007 the original author or authors. | |
| 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 | package net.sf.ezmorph.primitive; | |
| 18 | ||
| 19 | import net.sf.ezmorph.Morpher; | |
| 20 | ||
| 21 | /** | |
| 22 | * Base class for primitive value conversion.<br> | |
| 23 | * | |
| 24 | * @author Andres Almiray <aalmiray@users.sourceforge.net> | |
| 25 | */ | |
| 26 | public abstract class AbstractPrimitiveMorpher implements Morpher | |
| 27 | { | |
| 28 | 7079 | private boolean useDefault = false; |
| 29 | ||
| 30 | 1227 | public AbstractPrimitiveMorpher() |
| 31 | 409 | { |
| 32 | ||
| 33 | 1636 | } |
| 34 | ||
| 35 | /** | |
| 36 | * @param useDefault if morph() should return a default value if the value to | |
| 37 | * be morphed is null | |
| 38 | */ | |
| 39 | 4101 | public AbstractPrimitiveMorpher( boolean useDefault ) |
| 40 | 1342 | { |
| 41 | 5443 | this.useDefault = useDefault; |
| 42 | 5443 | } |
| 43 | ||
| 44 | /** | |
| 45 | * Returns if this morpher will use a default value if the value to be | |
| 46 | * morphed is null | |
| 47 | */ | |
| 48 | public boolean isUseDefault() | |
| 49 | { | |
| 50 | 1488 | return useDefault; |
| 51 | } | |
| 52 | ||
| 53 | /** | |
| 54 | * Returns true if the Morpher supports conversion from this Class.<br> | |
| 55 | * Supports any type that is not an Array. | |
| 56 | * | |
| 57 | * @param clazz the source Class | |
| 58 | * @return true if clazz is supported by this morpher, false otherwise. | |
| 59 | */ | |
| 60 | public boolean supports( Class clazz ) | |
| 61 | { | |
| 62 | 166 | return !clazz.isArray(); |
| 63 | } | |
| 64 | } |