org.simpleflatmapper.map.fieldmapper.FloatConstantTargetFieldMapper 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.
package org.simpleflatmapper.map.fieldmapper;
import org.simpleflatmapper.map.FieldMapper;
import org.simpleflatmapper.map.MappingContext;
import org.simpleflatmapper.map.getter.ContextualGetterAdapter;
import org.simpleflatmapper.map.getter.FloatContextualGetter;
import org.simpleflatmapper.map.setter.ContextualSetterAdapter;
import org.simpleflatmapper.map.setter.FloatContextualSetter;
import org.simpleflatmapper.reflect.primitive.FloatGetter;
import org.simpleflatmapper.reflect.primitive.FloatSetter;
public final class FloatConstantTargetFieldMapper implements FieldMapper {
private final FloatGetter super S> getter;
private final FloatContextualSetter super T> setter;
public FloatConstantTargetFieldMapper(final FloatGetter super S> getter, final FloatContextualSetter super T> setter) {
this.getter = getter;
this.setter = setter;
}
@Override
public void mapTo(final S source, final T target, final MappingContext super S> context) throws Exception {
setter.setFloat(target, getter.getFloat(source), context);
}
@Override
public String toString() {
return "FloatFieldMapper{" +
"getter=" + getter +
", setter=" + setter +
'}';
}
}