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

cool.scx.jdbc.result_handler.BeanListHandler Maven / Gradle / Ivy

There is a newer version: 2.7.4
Show newest version
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;
import java.util.ArrayList;
import java.util.List;

/**
 * a
 *
 * @author scx567888
 * @version 0.0.1
 */
record BeanListHandler(BeanBuilder beanBuilder) implements ResultHandler> {

    /**
     * {@inheritDoc}
     * a
     */
    @Override
    public List apply(ResultSet rs, Dialect dialect) throws SQLException {
        beanBuilder.bindDialect(dialect);
        var indexInfo = beanBuilder.getIndexInfo(rs.getMetaData());
        var list = new ArrayList();
        //从rs中取出数据,并且封装到ArrayList中
        while (rs.next()) {
            T t = beanBuilder.createBean(rs, indexInfo);
            list.add(t);
        }
        return list;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy