org.sfm.querydsl.getter.TupleIndexedGetter 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.querydsl.getter;
import com.mysema.query.Tuple;
import org.sfm.querydsl.TupleElementKey;
import org.sfm.reflect.Getter;
public class TupleIndexedGetter implements Getter {
private final Class extends P> type;
private final int index;
public TupleIndexedGetter(Class extends P> type, int index) {
this.type = type;
this.index = index;
}
@SuppressWarnings("unchecked")
public TupleIndexedGetter(TupleElementKey key) {
this((Class extends P>) key.getExpression().getType(), key.getIndex());
}
@Override
public P get(Tuple target) throws Exception {
return target.get(index, type);
}
}