Interface RowMapper<R>

Type Parameters:
R - The type of object this RowMapper yields from a ResultSet
All Known Subinterfaces:
RowMapper.Decupled<T,U,V,W,X,Z,A,B,C,D>, RowMapper.Hextupled<T,U,V,W,X,Z>, RowMapper.Nonupled<T,U,V,W,X,Z,A,B,C>, RowMapper.Octupled<T,U,V,W,X,Z,A,B>, RowMapper.Pentupled<T,U,V,W,X>, RowMapper.Quadrupled<T,U,V,W>, RowMapper.Septupled<T,U,V,W,X,Z,A>, RowMapper.Tripled<T,U,V>, RowMapper.Tupled<T,U>
All Known Implementing Classes:
AttributeMapper, AttributesRowMapper
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface RowMapper<R>
Defines how to map a ResultSet to an object. The given ResultSet is expected to be positioned at the "current" row, i.e. the RowMapper is not expected to be required to do any cursor placement before doing any value extraction.
  • Method Details

    • of

      static <R> RowMapper<R> of(ThrowingFunction<ResultSet,R,SQLException> mapper)
    • map

      R map(ResultSet resultSet) throws SQLException
      Obtain the result from the current row of a ResultSet.
      Parameters:
      resultSet - the ResultSet
      Returns:
      the result
      Throws:
      SQLException - if any error happens when processing the ResultSet. May be if the name/label is not valid, if a database access error occurs, or this method is called on a closed result set.
    • andThen

      default <S> RowMapper<S> andThen(Function<? super R,S> resultMapper)
      Create a new mapper which takes the result of this mapper and applies the given Function to yield another result.
      Type Parameters:
      S - the output type of the given resultMapper function, which also become the type of the result produced by the new row mapper.
      Parameters:
      resultMapper - the function to apply to the result
      Returns:
      the new row mapper
    • combinedWith

      default <S> RowMapper.Tupled<R,S> combinedWith(RowMapper<S> otherMapper)
      Create a new row mapper which first runs this mapper and then the given mapper, and combines the two results into a tuple-type container.
      Parameters:
      otherMapper - the mapper to run in addition to this.
      Returns:
      the new mapper