Module org.firebirdsql.jaybird
Package org.firebirdsql.jaybird.util

# Interface SQLExceptionThrowingFunction<T,R>

Type Parameters:
  `T` - type of the input to the function
  `R` - type of the result of the function

Functional Interface:
  This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface @NullUnmarked public interface SQLExceptionThrowingFunction<T,R>
Function that can throw a `SQLException`.

Since:
  6
Author:
  Mark Rotteveel

- ## Method Summary

  Modifier and Type
  Method
  Description
  `R`
  `apply(T t)`
  `default Function<T,R>`
  `toFunction()`
  Converts this instance to a normal `Function`, throwing `UncheckedSQLException` instead of `SQLException`.
  `static <T, R> Function<T,R>`
  `toFunction(SQLExceptionThrowingFunction<T,R> f)`
  Convenience method to convert a `SQLExceptionThrowingFunction` to a `Function`.
  `static <T, R> SQLExceptionThrowingFunction<T,R>`
  `toSQLExceptionThrowingFunction(Function<T,R> f)`
  Converts a normal `Function` to a `SQLExceptionThrowingFunction`, unwrapping any `UncheckedSQLException` thrown to `SQLException`.

- ## Method Details

  - ### apply

    R apply(T t) throws SQLException
    Throws:
      `SQLException`

  - ### toFunction

    default Function<T,R> toFunction()
    Converts this instance to a normal `Function`, throwing `UncheckedSQLException` instead of `SQLException`.
    Returns:
      normal `Function` instance throwing `UncheckedSQLException`
    See Also:
      - `toSQLExceptionThrowingFunction(Function)`

  - ### toFunction

    static <T, R> Function<T,R> toFunction(SQLExceptionThrowingFunction<T,R> f)
    Convenience method to convert a `SQLExceptionThrowingFunction` to a `Function`.

    Equivalent to `f.toFunction()`, but can be used for call-site type inference.

    Type Parameters:
      `T` - type of the input to the function
      `R` - type of the result of the function
    Parameters:
      `f` - function to convert
    Returns:
      normal `Function` instance throwing `UncheckedSQLException`
    See Also:
      - `toFunction()`

  - ### toSQLExceptionThrowingFunction

    static <T, R> SQLExceptionThrowingFunction<T,R> toSQLExceptionThrowingFunction(Function<T,R> f)
    Converts a normal `Function` to a `SQLExceptionThrowingFunction`, unwrapping any `UncheckedSQLException` thrown to `SQLException`.
    Type Parameters:
      `T` - type of the input to the function
      `R` - type of the result of the function
    Parameters:
      `f` - function to convert
    Returns:
      `SQLExceptionThrowingFunction` instance
    See Also:
      - `toFunction()`