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

org.sfm.jdbc.JdbcMapper Maven / Gradle / Ivy

Go to download

Java library to map flat record - ResultSet, csv - to java object with minimum configuration and low footprint.

There is a newer version: 1.10.3
Show newest version
package org.sfm.jdbc;

import org.sfm.map.Mapper;
import org.sfm.map.MappingException;
import org.sfm.utils.RowHandler;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Iterator;
//IFJAVA8_START
import java.util.stream.Stream;
//IFJAVA8_END



public interface JdbcMapper extends Mapper {
	
	/**
	 * Loop over the resultSet, map each row to a new instance of T and call back the handler
	 * @param rs the resultSet
	 * @param handle the handler that will get the callback
	 * @return the handler passed in
	 * @throws SQLException if sql error occurs
	 * @throws MappingException if an error occurs during the mapping
	 */
	> H forEach(ResultSet rs, H handle) throws SQLException, MappingException;
	
	/**
	 * 
	 * @param rs the result set
	 * @return an iterator that will return a map object for each row of the result set.
	 * @throws SQLException
	 * @throws MappingException
	 */
	Iterator iterator(ResultSet rs) throws SQLException, MappingException;

	@Deprecated
	Iterator iterate(ResultSet rs) throws SQLException, MappingException;

	/**
	 * 
	 * @param rs the result set
	 * @return a stream that will contain a map object for each row of the result set.
	 * @throws SQLException
	 * @throws MappingException
	 */
	//IFJAVA8_START
	Stream stream(ResultSet rs) throws SQLException, MappingException;
	//IFJAVA8_END

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy