use of org.skife.jdbi.v2.tweak.ResultSetMapper in project killbill by killbill.
the class DBTestingHelper method getDBI.
@Override
public synchronized IDBI getDBI() {
if (dbi == null) {
final RetryableDataSource retryableDataSource = new RetryableDataSource(getDataSource());
dbi = (DBI) new DBIProvider(null, retryableDataSource, null).get();
// Register KB specific mappers
for (final ResultSetMapperFactory resultSetMapperFactory : IDBISetup.mapperFactoriesToRegister()) {
dbi.registerMapper(resultSetMapperFactory);
}
for (final ResultSetMapper resultSetMapper : IDBISetup.mappersToRegister()) {
dbi.registerMapper(resultSetMapper);
}
}
return dbi;
}
use of org.skife.jdbi.v2.tweak.ResultSetMapper in project SimpleFlatMapper by arnaudroger.
the class SfmResultSetMapperFactory method mapperFor.
@SuppressWarnings("unchecked")
@Override
public ResultSetMapper mapperFor(Class aClass, StatementContext statementContext) {
ResultSetMapper mapper = cache.get(aClass);
if (mapper == null) {
ContextualSourceMapper<ResultSet, ?> resultSetMapper = mapperFactory.newInstance(aClass);
mapper = toResultSetMapper(resultSetMapper);
ResultSetMapper<?> cachedMapper = cache.putIfAbsent(aClass, mapper);
if (cachedMapper != null) {
mapper = cachedMapper;
}
}
return mapper;
}
Aggregations