use of com.hubspot.rosetta.RosettaMapper in project Rosetta by HubSpot.
the class RosettaMapperFactory method mapperFor.
@Override
@SuppressWarnings({ "rawtypes", "unchecked" })
public ResultSetMapper mapperFor(Class rawType, StatementContext ctx) {
ObjectMapper objectMapper = RosettaObjectMapperOverride.resolve(ctx);
final Type genericType;
if (ctx.getSqlObjectMethod() == null) {
genericType = rawType;
} else {
genericType = determineGenericReturnType(rawType, ctx.getSqlObjectMethod().getGenericReturnType());
}
final RosettaMapper mapper = new RosettaMapper(genericType, objectMapper, extractTableName(ctx.getRewrittenSql()));
return new ResultSetMapper() {
@Override
public Object map(int index, ResultSet r, StatementContext ctx) throws SQLException {
return mapper.mapRow(r);
}
};
}
Aggregations