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