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

com.jpattern.orm.generator.wrapper.JodaLocalDateToSqlTimestampWrapper 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.LocalDate;

/**
 * 
 * @author Francesco Cina'
 *
 * Mar 27, 2012
 */
public class JodaLocalDateToSqlTimestampWrapper implements IWrapper {

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

	@Override
	public LocalDate wrap(Timestamp value) {
		return new LocalDate(value);
	}

	@Override
	public Timestamp unWrap(LocalDate value) {
		return new Timestamp(value.toDateMidnight().getMillis());
	}

	public static LocalDate staticWrap(Timestamp value) {
		return new LocalDate(value);
	}

	public static Timestamp staticUnWrap(LocalDate value) {
		return new Timestamp(value.toDateMidnight().getMillis());
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy