All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.sfm.map.impl.fieldmapper.FieldMapperImpl Maven / Gradle / Ivy

Go to download

Java library to map flat record - ResultSet, csv - to java object with minimum configuration and low footprint.

There is a newer version: 1.10.3
Show newest version
package org.sfm.map.impl.fieldmapper;

import org.sfm.map.FieldMapper;
import org.sfm.map.MappingContext;
import org.sfm.reflect.Getter;
import org.sfm.reflect.Setter;

public final class FieldMapperImpl implements FieldMapper {
	
	private final Getter getter;
	private final Setter setter;
	
	public FieldMapperImpl(final Getter getter, final Setter setter) {
		this.getter = getter;
		this.setter = setter;
	}
	
	@Override
	public void mapTo(final S source, final T target, final MappingContext mappingContext) throws Exception {
		final P value = getter.get(source);
		setter.set(target, value);
	}

    @Override
    public String toString() {
        return "FieldMapperImpl{" +
                "getter=" + getter +
                ", setter=" + setter +
                '}';
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy