org.skife.jdbi.v2.tweak.ResultSetMapper Java Examples

The following examples show how to use org.skife.jdbi.v2.tweak.ResultSetMapper. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SfmResultSetMapperFactory.java    From SimpleFlatMapper with MIT License 6 votes vote down vote up
@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;
}
 
Example #2
Source File: SfmResultSetMapperFactory.java    From SimpleFlatMapper with MIT License 5 votes vote down vote up
private <T> ResultSetMapper<T> toResultSetMapper(ContextualSourceMapper<ResultSet, T> resultSetMapper) {
    ResultSetMapper mapper;
    if (resultSetMapper instanceof DynamicJdbcMapper) {
        mapper = new DynamicSfmResultSetMapper<T>((DynamicJdbcMapper<T>) resultSetMapper);
    } else {
        mapper = new DefaultSfmResultSetMapper<T>(resultSetMapper);
    }
    return mapper;
}
 
Example #3
Source File: UuidUtil.java    From presto with Apache License 2.0 4 votes vote down vote up
@Override
public ResultSetMapper mapperFor(Class type, StatementContext ctx)
{
    return new UuidMapper();
}
 
Example #4
Source File: EtlBeanMapperFactory.java    From pocket-etl with Apache License 2.0 4 votes vote down vote up
@Override
@SuppressWarnings("unchecked")
public ResultSetMapper mapperFor(Class type, StatementContext ctx) {
    return new EtlBeanMapper<>(type, secondaryMapper);
}
 
Example #5
Source File: BeanMapperFactory.java    From monasca-common with Apache License 2.0 4 votes vote down vote up
@Override
public ResultSetMapper mapperFor(Class type, StatementContext ctx) {
  return new BeanMapper(type);
}