org.simpleflatmapper.reflect.getter.GetterOnGetter 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;
public class GetterOnGetter implements Getter {
private final Getter super O, ? extends I> g1;
private final Getter super I, ? extends P> g2;
public GetterOnGetter(Getter super O, ? extends I> g1,
Getter super I, ? extends P> g2) {
this.g1 = g1;
this.g2 = g2;
}
@Override
public P get(O target) throws Exception {
I i = g1.get(target);
if (i != null) {
return g2.get(i);
}
return null;
}
@Override
public String toString() {
return "GetterOnGetter{" +
"g1=" + g1 +
", g2=" + g2 +
'}';
}
}