All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.simpleflatmapper.jdbi3.DynamicRowMapper Maven / Gradle / Ivy

There is a newer version: 8.2.3
Show newest version
package org.simpleflatmapper.jdbi3;

import org.jdbi.v3.core.mapper.RowMapper;
import org.jdbi.v3.core.statement.StatementContext;
import org.simpleflatmapper.jdbc.DynamicJdbcMapper;

import java.sql.ResultSet;
import java.sql.SQLException;

public class DynamicRowMapper implements RowMapper {

    private final DynamicJdbcMapper dynamicMapper;

    public DynamicRowMapper(DynamicJdbcMapper dynamicMapper) {
        this.dynamicMapper = dynamicMapper;
    }

    @Override
    public T map(ResultSet resultSet, StatementContext statementContext) throws SQLException {
        return dynamicMapper.map(resultSet);
    }

    @Override
    public RowMapper specialize(ResultSet rs, StatementContext ctx) throws SQLException {
        return new StaticRowMapper(dynamicMapper.getMapper(rs.getMetaData()));
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy