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

net.freeutils.util.db.ResultsHandler Maven / Gradle / Ivy

The newest version!
/*
 *  Copyright © 2003-2024 Amichai Rothman
 *
 *  This file is part of JElementary - the Java Elementary Utilities package.
 *
 *  JElementary is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  JElementary is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with JElementary.  If not, see .
 *
 *  For additional info see https://www.freeutils.net/source/jelementary/
 */

package net.freeutils.util.db;

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

/**
 * The {@code ResultsHandler} interface defines the means for a concrete handler to
 * process a query's result set and return it as a simple Java construct,
 * thus hiding the JDBC handling specifics from the caller and reducing boilerplate
 * code.
 *
 * @param  the type of the result returned by the handler
 * @author Amichai Rothman
 * @since 2010-02-20
 */
public interface ResultsHandler {

    /**
     * Handles the given results set, returning an object representing
     * the returned results. The returned object must not use the
     * ResultSet after this method returns, as it may be closed by then.
     *
     * @param rs the result set to handle
     * @return an object representing the returned results
     * @throws SQLException if the ResultSet encounters an error
     */
    T handle(ResultSet rs) throws SQLException;

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy