de.akquinet.jbosscc.guttenbase.mapping.BigDecimalToLongColumnDataMapper Maven / Gradle / Ivy
package de.akquinet.jbosscc.guttenbase.mapping;
import java.math.BigDecimal;
import java.sql.SQLException;
import de.akquinet.jbosscc.guttenbase.meta.ColumnMetaData;
/**
* Map BigDecimal to Long/Bigint
*
* © 2013 akquinet tech@spree
*
*
* @author M. Dahm
*/
public class BigDecimalToLongColumnDataMapper implements ColumnDataMapper
{
@Override
public boolean isApplicable(final ColumnMetaData sourceColumnMetaData, final ColumnMetaData targetColumnMetaData)
throws SQLException
{
return true;
}
@Override
public Object map(final ColumnMetaData sourceColumnMetaData, final ColumnMetaData targetColumnMetaData, final Object value)
throws SQLException
{
if (value != null)
{
final BigDecimal bigDecimal = (BigDecimal) value;
return bigDecimal.longValue();
}
else
{
return null;
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy