Interface JdbcClient.RowMapper<T>

Type Parameters:
T - mapped type
Enclosing interface:
JdbcClient
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@Contract @FunctionalInterface public static interface JdbcClient.RowMapper<T>
Maps one JDBC row to an application value during a callback.

Imperative code passes a mapper to JdbcClient.Statement.map(RowMapper) or JdbcClient.GeneratedKeys.map(RowMapper). Applications may also register implementations as services. A generated repository resolves a mapper selected by @Jdbc.RowMapper(SomeMapper.class) by its concrete service type. The marker form @Jdbc.RowMapper resolves this contract with the exact T type.

A mapper held by a singleton repository may be invoked concurrently. It must be stateless or safe for concurrent use. Each invocation receives its own row. The row may be read only by the thread executing map(Row). The provider retains ownership of the JDBC resources and exposes only the scoped row view.

  • Method Summary

    Modifier and Type
    Method
    Description
    Maps the current row synchronously.
  • Method Details

    • map

      T map(JdbcClient.Row row)
      Maps the current row synchronously. Row reads call the JDBC driver and may block until the driver returns or reports a failure. The row may be read only by the current thread and is no longer valid after this method returns.
      Parameters:
      row - current row
      Returns:
      mapped value, never null