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 34 public class ByteTypeHandler implements ConfigurationTypeHandler { 35 36 45 public Object toObject(Class type, String stringValue) 46 throws TypeConversionException { 47 48 Byte object = null; 49 try { 50 object = Byte.valueOf(stringValue); 51 } catch (NumberFormatException nfe) { 52 throw new TypeConversionException( 53 this.getClass(), 54 "Couldn't format", nfe); 55 } 56 return object; 57 } 58 59 66 public String toString(Object objectValue) { 67 return ((Byte ) objectValue).toString(); 68 } 69 70 } 71 | Popular Tags |