org.simpleflatmapper.map.getter.BoxedBooleanContextualGetter Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sfm-map Show documentation
Show all versions of sfm-map Show documentation
Java library to map flat record - ResultSet, csv - to java object with minimum configuration and low footprint.
The newest version!
package org.simpleflatmapper.map.getter;
import org.simpleflatmapper.converter.Context;
public class BoxedBooleanContextualGetter implements BooleanContextualGetter, ContextualGetter {
private final ContextualGetter super T, ? extends Boolean> delegate;
public BoxedBooleanContextualGetter(ContextualGetter super T, ? extends Boolean> delegate) {
this.delegate = delegate;
}
@Override
public boolean getBoolean(T target, Context mappingContext) throws Exception {
final Boolean bool = get(target, mappingContext);
if (bool != null) {
return bool.booleanValue();
}
return false;
}
@Override
public Boolean get(T target, Context context) throws Exception {
return delegate.get(target, context);
}
}