org.simpleflatmapper.reflect.getter.BiFunctionGetter Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sfm-reflect Show documentation
Show all versions of sfm-reflect Show documentation
Java library to map flat record - ResultSet, csv - to java object with minimum configuration and low footprint.
package org.simpleflatmapper.reflect.getter;
import org.simpleflatmapper.reflect.Getter;
import org.simpleflatmapper.util.BiFunction;
import org.simpleflatmapper.util.ErrorHelper;
public final class BiFunctionGetter implements BiFunction {
private final Getter super S1, ? extends T> getter;
public BiFunctionGetter(Getter super S1, ? extends T> getter) {
this.getter = getter;
}
@Override
public T apply(S1 s1, S2 s2) {
try {
return getter.get(s1);
} catch (Exception e) {
return ErrorHelper.rethrow(e);
}
}
public Getter super S1, ? extends T> getGetter() {
return getter;
}
}