1 3 package jodd.typeconverter; 4 5 import java.math.BigInteger ; 6 7 10 public class BigIntegerConverter implements TypeConverter { 11 12 public static BigInteger valueOf(Object value) { 13 if (value == null) { 14 return null; 15 } 16 if (value instanceof BigInteger ) { 17 return (BigInteger ) value; 18 } 19 try { 20 return (new BigInteger (value.toString())); 21 } catch (NumberFormatException nfex) { 22 throw new TypeConversionException(nfex); 23 } 24 } 25 26 public Object convert(Object value) { 27 return valueOf(value); 28 } 29 30 } 31 | Popular Tags |