com.jpattern.orm.generator.wrapper.JodaLocalDateToSqlTimestampWrapper Maven / Gradle / Ivy
package com.jpattern.orm.generator.wrapper;
import java.sql.Timestamp;
import org.joda.time.LocalDate;
/**
*
* @author Francesco Cina'
*
* Mar 27, 2012
*/
public class JodaLocalDateToSqlTimestampWrapper implements TypeWrapper {
@Override
public Class resultSetTypeToUse() {
return Timestamp.class;
}
@Override
public Class wrapperClass() {
return LocalDate.class;
}
@Override
public LocalDate wrap(final Timestamp value) {
if (value==null) {
return null;
}
return new LocalDate(value);
}
@Override
public Timestamp unWrap(final LocalDate value) {
if (value==null) {
return null;
}
return new Timestamp(value.toDateMidnight().getMillis());
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy