package org.simpleflatmapper.map.fieldmapper;
import org.simpleflatmapper.map.FieldMapper;
import org.simpleflatmapper.map.MappingContext;
import org.simpleflatmapper.reflect.primitive.CharacterGetter;
import org.simpleflatmapper.reflect.primitive.CharacterSetter;
public final class CharacterFieldMapper<S, T> implements FieldMapper<S, T> {
private final CharacterGetter<? super S> getter;
private final CharacterSetter<? super T> setter;
public CharacterFieldMapper(final CharacterGetter<? super S> getter, final CharacterSetter<? 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.setCharacter(target, getter.getCharacter(source));
}
@Override
public String toString() {
return "CharacterFieldMapper{" +
"getter=" + getter +
", setter=" + setter +
'}';
}
}