Interface Database.ConnectionOperation<T>

Type Parameters:
T - The type of result produced by the operation executed within the database connection
Enclosing class:
Database
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface private static interface Database.ConnectionOperation<T>
A functional interface representing a database operation that executes a specific task using a provided Connection object. This operation is designed to encapsulate reusable database logic and handle SQL-related exceptions within a connection context.
  • Method Summary

    Modifier and Type
    Method
    Description
    execute(Connection connection)
    Executes a database operation using the provided Connection and returns the result of type T.
  • Method Details

    • execute

      T execute(Connection connection) throws SQLException
      Executes a database operation using the provided Connection and returns the result of type T. This method encapsulates the logic for performing a specific task within the scope of the database connection.
      Parameters:
      connection - The Connection object to be used for executing the operation. Must not be null.
      Returns:
      An object of type T, representing the result of the executed database operation.
      Throws:
      SQLException - If a database access error occurs or the operation fails.