@Test public void Stringからのconvertテスト() throws Exception { SimpleDateFormat sdf = new SimpleDateFormat(); sdf.applyPattern("yyyy/MM/dd HH:mm:ss.SSS"); String ymdhmss = "2011/11/11 13:45:56.789"; assertEquals(sdf.parse(ymdhmss), new TimestampConverter().convert(ymdhmss)); sdf.applyPattern("yyyy/MM/dd"); String ymdhms = "2011/11/11 13:45:56"; assertEquals(sdf.parse(ymdhms), new TimestampConverter().convert(ymdhms)); String ymdhm = "2011/11/11 13:45"; assertEquals(sdf.parse(ymdhm), new TimestampConverter().convert(ymdhm)); String ymdh = "2011/11/11 13"; assertEquals(sdf.parse(ymdh), new TimestampConverter().convert(ymdh)); String ymd = "2011/11/11"; assertEquals(sdf.parse(ymd), new TimestampConverter().convert(ymd)); sdf.applyPattern("yyyy-MM-dd HH:mm:ss.SSS"); String hymdhmss = "2011-11-11 13:45:56.789"; assertEquals(sdf.parse(hymdhmss), new TimestampConverter().convert(hymdhmss)); sdf.applyPattern("yyyy-MM-dd"); String hymdhms = "2011-11-11 13:45:56"; assertEquals(sdf.parse(hymdhms), new TimestampConverter().convert(hymdhms)); String hymdhm = "2011-11-11 13:45"; assertEquals(sdf.parse(hymdhm), new TimestampConverter().convert(hymdhm)); String hymdh = "2011-11-11 13"; assertEquals(sdf.parse(hymdh), new TimestampConverter().convert(hymdh)); String hymd = "2011-11-11"; assertEquals(sdf.parse(hymd), new TimestampConverter().convert(hymd)); }
public Timestamp convert(java.sql.Date d) { return new Timestamp(d.getTime()); }
TimestampConverter implements TypeConverter<Timestamp> { public Timestamp convert(java.sql.Date d) { return new Timestamp(d.getTime()); } }
TimestampConverter implements TypeConverter<Timestamp> { public Timestamp convert(java.sql.Date d) { return new Timestamp(d.getTime()); } TimestampConverter(); }
TimestampConverter implements TypeConverter<Timestamp> { public Timestamp convert(java.sql.Date d) { return new Timestamp(d.getTime()); } TimestampConverter(); Timestamp convert(java.sql.Date d); Timestamp convert(java.util.Date d); Timestamp convert(String v); }
TimestampConverter implements TypeConverter<Timestamp> { public Timestamp convert(java.sql.Date d) { return new Timestamp(d.getTime()); } TimestampConverter(); Timestamp convert(java.sql.Date d); Timestamp convert(java.util.Date d); Timestamp convert(String v);  }