View Javadoc

1   package liquibase.executor.jvm;
2   
3   import java.sql.ResultSet;
4   import java.sql.SQLException;
5   
6   /**
7    * An interface used by {@link liquibase.executor.Executor} for mapping rows of a {@link java.sql.ResultSet} on a
8    * per-row basis. Implementations of this interface perform the actual work of mapping each row to a result object, but
9    * don't need to worry about exception handling. {@link java.sql.SQLException SQLExceptions} will be caught and handled
10   * by the calling JdbcTemplate.
11   * <p/>
12   * 
13   * @author Spring Framework
14   * @see liquibase.executor.Executor
15   * @see RowCallbackHandler
16   * @see ResultSetExtractor
17   */
18  public interface RowMapper {
19  
20      /**
21       * Implementations must implement this method to map each row of data in the ResultSet. This method should not call
22       * <code>next()</code> on the ResultSet; it is only supposed to map values of the current row.
23       * 
24       * @param rs
25       *            the ResultSet to map (pre-initialized for the current row)
26       * @param rowNum
27       *            the number of the current row
28       * @return the result object for the current row
29       * @throws java.sql.SQLException
30       *             if a SQLException is encountered getting column values (that is, there's no need to catch
31       *             SQLException)
32       */
33      Object mapRow(ResultSet rs, int rowNum) throws SQLException;
34  
35  }