org.simpleflatmapper.reflect.getter.BiFunctionGetter Maven / Gradle / Ivy
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 getter;
public BiFunctionGetter(Getter 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 getGetter() {
return getter;
}
}