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

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

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

import java.sql.Date;
import org.joda.time.DateMidnight;

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

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

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

	@Override
	public DateMidnight wrap(final Date value) {
		if (value==null) {
			return null;
		}
		return new DateMidnight(value.getTime());
	}

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

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy