Interface ConnectionOperations<C>

Type Parameters:
C - The connection type.
All Known Subinterfaces:
DataSourceConnectionOperations, MongoConnectionOperations
All Known Implementing Classes:
AbstractConnectionOperations, DefaultDataSourceConnectionOperations, HibernateConnectionConnectionOperations, HibernateConnectionOperations, SpringHibernateConnectionOperations, SpringJdbcConnectionOperations, SynchronousConnectionOperationsFromReactiveConnectionOperations

public interface ConnectionOperations<C>
The synchronous connection operations interface.
Since:
4.0.0
Author:
Denis Stepanov
  • Method Details

    • getConnectionStatus

      @NonNull default @NonNull ConnectionStatus<C> getConnectionStatus()
      Obtains the current required connection.
      Returns:
      The connection or exception if the connection doesn't exist
    • findConnectionStatus

      Optional<ConnectionStatus<C>> findConnectionStatus()
      Obtains the current connection.
      Returns:
      The optional connection
    • execute

      <R> R execute(@NonNull @NonNull ConnectionDefinition definition, @NonNull @NonNull Function<ConnectionStatus<C>,R> callback)
      Execute a connection within the context of the function.
      Type Parameters:
      R - The result
      Parameters:
      definition - The connection definition
      callback - The call back
      Returns:
      The result
    • executeRead

      default <R> R executeRead(@NonNull @NonNull Function<ConnectionStatus<C>,R> callback)
      Execute a read-only connection within the context of the function. NOTE: The connection manager might not support the read only connection!
      Type Parameters:
      R - The result
      Parameters:
      callback - The call back
      Returns:
      The result
    • executeWrite

      default <R> R executeWrite(@NonNull @NonNull Function<ConnectionStatus<C>,R> callback)
      Execute a write supported connection within the context of the function.
      Type Parameters:
      R - The result
      Parameters:
      callback - The call back
      Returns:
      The result