1 package jodd.bean.converters; 2 3 import java.sql.Timestamp; 4 5 8 public final class SqlTimestampConverter implements jodd.bean.Converter { 9 10 11 public Object convert(Object value) { 12 if (value == null) { 13 return (Timestamp) null; 14 } 15 16 if (value instanceof Timestamp) { 17 return value; 18 } 19 try { 20 return (Timestamp.valueOf(value.toString())); 21 } catch (Exception e) { 22 throw new IllegalArgumentException("SqlTimestamp conversion for " + value + " failed."); 23 } 24 } 25 26 } 27 | Popular Tags |