com.jpattern.orm.generator.wrapper.BooleanToBigDecimalWrapper Maven / Gradle / Ivy
package com.jpattern.orm.generator.wrapper;
import java.math.BigDecimal;
/**
*
* @author Francesco Cina'
*
* Apr 1, 2012
*/
public class BooleanToBigDecimalWrapper implements TypeWrapper {
@Override
public Class resultSetTypeToUse() {
return BigDecimal.class;
}
@Override
public Class wrapperClass() {
return Boolean.class;
}
@Override
public Boolean wrap(final BigDecimal value) {
if (value==null) {
return null;
}
return Boolean.valueOf( !BigDecimal.ZERO.equals(value) );
}
@Override
public BigDecimal unWrap(final Boolean value) {
if (value==null) {
return null;
}
if (value) {
return BigDecimal.ONE;
}
return BigDecimal.ZERO;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy