org.simpleflatmapper.map.fieldmapper.BooleanConstantTargetFieldMapper 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.fieldmapper;
import org.simpleflatmapper.map.FieldMapper;
import org.simpleflatmapper.map.MappingContext;
import org.simpleflatmapper.map.getter.BooleanContextualGetter;
import org.simpleflatmapper.map.getter.ContextualGetterAdapter;
import org.simpleflatmapper.map.setter.BooleanContextualSetter;
import org.simpleflatmapper.map.setter.ContextualSetterAdapter;
import org.simpleflatmapper.reflect.primitive.BooleanGetter;
import org.simpleflatmapper.reflect.primitive.BooleanSetter;
public final class BooleanConstantTargetFieldMapper implements FieldMapper {
private final BooleanGetter super S> getter;
private final BooleanContextualSetter super T> setter;
public BooleanConstantTargetFieldMapper(final BooleanGetter super S> getter, final BooleanContextualSetter super T> setter) {
this.getter = getter;
this.setter = setter;
}
@Override
public void mapTo(final S source, final T target, final MappingContext super S> mappingContext) throws Exception {
setter.setBoolean(target, getter.getBoolean(source), mappingContext);
}
@Override
public String toString() {
return "BooleanFieldMapper{" +
"getter=" + getter +
", setter=" + setter +
'}';
}
}