org.sfm.reflect.ConstructorOnGetter Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of simpleFlatMapper Show documentation
Show all versions of simpleFlatMapper Show documentation
Java library to map flat record - ResultSet, csv - to java object with minimum configuration and low footprint.
package org.sfm.reflect;
import java.lang.reflect.Constructor;
public class ConstructorOnGetter implements Getter {
private final Constructor extends P> constructor;
private final Getter getter;
public ConstructorOnGetter(Constructor extends P> constructor, Getter getter) {
super();
this.constructor = constructor;
this.getter = getter;
}
@Override
public P get(T target) throws Exception {
return constructor.newInstance(getter.get(target));
}
}