org.sfm.map.impl.fieldmapper.BooleanFieldMapper Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of simpleFlatMapper Show documentation
Show all versions of simpleFlatMapper Show documentation
Java library to map flat record - ResultSet, csv - to java object with minimum configuration and low footprint.
package org.sfm.map.impl.fieldmapper;
import org.sfm.map.FieldMapper;
import org.sfm.map.MappingContext;
import org.sfm.reflect.primitive.BooleanGetter;
import org.sfm.reflect.primitive.BooleanSetter;
public final class BooleanFieldMapper implements FieldMapper {
private final BooleanGetter getter;
private final BooleanSetter setter;
public BooleanFieldMapper(final BooleanGetter getter, final BooleanSetter setter) {
this.getter = getter;
this.setter = setter;
}
@Override
public void mapTo(final S source, final T target, final MappingContext mappingContext) throws Exception {
setter.setBoolean(target, getter.getBoolean(source));
}
@Override
public String toString() {
return "BooleanFieldMapper{" +
"getter=" + getter +
", setter=" + setter +
'}';
}
}