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

com.bixuebihui.jdbc.RowMapperResultReader Maven / Gradle / Ivy

Go to download

a fast small database connection pool and a active record flavor mini framework

There is a newer version: 1.15.3.3
Show newest version
package com.bixuebihui.jdbc;

import javax.validation.constraints.NotNull;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;

/**
 * 

RowMapperResultReader class.

* * @author xingwx * @version $Id: $Id */ public class RowMapperResultReader { private final RowMapper handle; private List res; /** *

Constructor for RowMapperResultReader.

* * @param handle a {@link RowMapper} object. */ public RowMapperResultReader(RowMapper handle){ this.handle = handle; } /** *

Constructor for RowMapperResultReader.

* * @param handle a {@link RowMapper} object. * @param resultList a {@link java.util.List} object. */ public RowMapperResultReader(RowMapper handle, List resultList){ this.handle = handle; this.res = resultList; } /** *

processResultSet.

* * @param rs a {@link java.sql.ResultSet} object. * @return a {@link java.util.List} object. * @throws java.sql.SQLException if any. */ public @NotNull List processResultSet(ResultSet rs, Set fields) throws SQLException { if(res==null){ res = new ArrayList(); }else{ res.clear(); } int index=1; while (rs.next()) { res.add( handle.mapRow(rs, index++, fields)); } return res; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy