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

de.akquinet.jbosscc.guttenbase.mapping.TimestampToDateColumnDataMapper Maven / Gradle / Ivy

There is a newer version: 2.1.0
Show newest version
package de.akquinet.jbosscc.guttenbase.mapping;

import java.sql.Date;
import java.sql.Timestamp;

import de.akquinet.jbosscc.guttenbase.meta.ColumnMetaData;

/**
 * Map Timestamp to Date as some databases use a DATETIME column others a simple DATE.
 * 
 * 

* © 2012 akquinet tech@spree *

* * @author M. Dahm */ public final class TimestampToDateColumnDataMapper implements ColumnDataMapper { @Override public Object map(final ColumnMetaData sourceColumnMetaData, final ColumnMetaData targetColumnMetaData, final Object value) { if (value == null) { return null; } else { return new Date(((Timestamp) value).getTime()); } } @Override public boolean isApplicable(final ColumnMetaData sourceColumnMetaData, final ColumnMetaData targetColumnMetaData) { return true; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy