Package org.soulwing.jdbc
Interface RowMapper<T>
-
- Type Parameters:
T
- the type of object produced by this mapper
public interface RowMapper<T>
A closure that maps a row in aResultSet
to an instance of a given type.Example:
RowMapper<Person> personMapper = new RowMapper<>() { public Person mapRow(ResultSet rs, int rowNum) throws SQLException { Person person = new Person(); person.setId(rs.getLong("id")); person.setName(rs.getName("name")); person.setAge(rs.getInt("age")); return person; } };
- Author:
- Carl Harris
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description T
mapRow(ResultSet rs, int rowNum)
Maps a single row in aResultSet
to a new instance of the receiver's declared data type.
-
-
-
Method Detail
-
mapRow
T mapRow(ResultSet rs, int rowNum) throws SQLException
Maps a single row in aResultSet
to a new instance of the receiver's declared data type.- Parameters:
rs
- result set positioned to the row that is to be mappedrowNum
- current row number (the first row is row 1)- Returns:
- instance of type
T
- Throws:
SQLException
-
-