org.simpleflatmapper.map.getter.InstantiatorContextualGetter 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.getter;
import org.simpleflatmapper.converter.Context;
import org.simpleflatmapper.reflect.Instantiator;
public class InstantiatorContextualGetter implements ContextualGetter {
private final Instantiator super S, ? extends P> instantiator;
private final ContextualGetter super T, ? extends S> getter;
public InstantiatorContextualGetter(Instantiator super S, ? extends P> instantiator, ContextualGetter super T, ? extends S> getter) {
this.instantiator = instantiator;
this.getter = getter;
}
@Override
public P get(T target, Context mappingContext) throws Exception {
return instantiator.newInstance(getter.get(target, mappingContext));
}
}