1 17 18 package org.sape.carbon.core.config.type.handlers; 19 20 21 22 import org.sape.carbon.core.config.type.ConfigurationTypeHandler; 23 import org.sape.carbon.core.config.type.TypeConversionException; 24 25 33 public class ShortTypeHandler implements ConfigurationTypeHandler { 34 35 44 public Object toObject(Class type, String stringValue) 45 throws TypeConversionException { 46 47 Short object = null; 48 try { 49 object = Short.valueOf(stringValue); 50 } catch (NumberFormatException nfe) { 51 throw new TypeConversionException( 52 this.getClass(), 53 "Couldn't format", nfe); 54 } 55 return object; 56 } 57 58 65 public String toString(Object objectValue) { 66 return ((Short ) objectValue).toString(); 67 } 68 69 } 70 | Popular Tags |