All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.jpattern.orm.generator.wrapper.JodaDateTimeToSqlTimestampWrapper Maven / Gradle / Ivy

There is a newer version: 3.5.1
Show newest version
package com.jpattern.orm.generator.wrapper;

import java.sql.Timestamp;

import org.joda.time.DateTime;

/**
 * 
 * @author Francesco Cina'
 *
 * Mar 27, 2012
 */
public class JodaDateTimeToSqlTimestampWrapper implements TypeWrapper {

	@Override
	public Class resultSetTypeToUse() {
		return Timestamp.class;
	}

	@Override
	public Class wrapperClass() {
		return DateTime.class;
	}

	@Override
	public DateTime wrap(final Timestamp value) {
		if (value==null) {
			return null;
		}
		return new DateTime(value);
	}

	@Override
	public Timestamp unWrap(final DateTime value) {
		if (value==null) {
			return null;
		}
		return new Timestamp(value.getMillis());
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy