cool.scx.jdbc.result_handler.BeanHandler Maven / Gradle / Ivy
package cool.scx.jdbc.result_handler;
import cool.scx.jdbc.bean_builder.BeanBuilder;
import cool.scx.jdbc.dialect.Dialect;
import java.sql.ResultSet;
import java.sql.SQLException;
/**
* BeanBuilder interface.
*
* @author scx567888
* @version 0.2.1
*/
record BeanHandler(BeanBuilder beanBuilder) implements ResultHandler {
@Override
public T apply(ResultSet rs, Dialect dialect) throws SQLException {
beanBuilder.bindDialect(dialect);
var indexInfo = beanBuilder.getIndexInfo(rs.getMetaData());
return rs.next() ? beanBuilder.createBean(rs, indexInfo) : null;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy