Interface CommandImplementors


public interface CommandImplementors
A factory interface for creating Command implementation objects.

This interface provides factory methods for instantiating various types of database commands used in the Doma framework. Each method creates a specific type of command object that is responsible for executing a corresponding Query object.

Implementations of this interface are responsible for creating the appropriate command objects based on the DAO method being executed. These command objects handle the execution of database operations (select, insert, update, delete, batch operations, etc.) and process the results.

The default implementations of these methods create standard command objects, but custom implementations can override these methods to provide specialized behavior or extended functionality for specific command types, such as custom transaction handling, logging, or performance monitoring.

  • Method Details

    • createSelectCommand

      default <RESULT> SelectCommand<RESULT> createSelectCommand(Method method, SelectQuery query, ResultSetHandler<RESULT> resultSetHandler)
      Creates a SelectCommand object.
      Type Parameters:
      RESULT - the result type of the command
      Parameters:
      method - the DAO method
      query - the query
      resultSetHandler - the result set handler
      Returns:
      the command
    • createAggregateCommand

      default <RESULT, ENTITY> AggregateCommand<RESULT,ENTITY> createAggregateCommand(Method method, SelectQuery query, EntityType<ENTITY> entityType, StreamReducer<RESULT,ENTITY> resultReducer, AggregateStrategyType aggregateStrategyType)
      Creates an AggregateCommand object for aggregating entities based on a specified query and strategy.
      Type Parameters:
      RESULT - the result type of the aggregation
      ENTITY - the entity type used in the aggregation
      Parameters:
      method - the DAO method associated with the command
      query - the select query to be executed
      entityType - the type of the root entity for aggregation
      resultReducer - the reducer used to process the stream of aggregated entities into a final result
      aggregateStrategyType - the strategy type used for aggregation logic
      Returns:
      a new AggregateCommand instance configured with the provided parameters
    • createDeleteCommand

      default DeleteCommand createDeleteCommand(Method method, DeleteQuery query)
      Creates a DeleteCommand object.
      Parameters:
      method - the DAO method
      query - the query
      Returns:
      the command
    • createInsertCommand

      default InsertCommand createInsertCommand(Method method, InsertQuery query)
      Creates an InsertCommand object.
      Parameters:
      method - the DAO method
      query - the query
      Returns:
      the command
    • createUpdateCommand

      default UpdateCommand createUpdateCommand(Method method, UpdateQuery query)
      Creates an UpdateCommand object.
      Parameters:
      method - the DAO method
      query - the query
      Returns:
      the command
    • createDeleteReturningCommand

      default <RESULT> DeleteReturningCommand<RESULT> createDeleteReturningCommand(Method method, DeleteQuery query, ResultSetHandler<RESULT> resultSetHandler, Supplier<RESULT> emptyResultSupplier)
      Creates a DeleteReturningCommand object.
      Type Parameters:
      RESULT - the result type of the command
      Parameters:
      method - the DAO method
      query - the delete query
      resultSetHandler - the handler for processing the result set
      emptyResultSupplier - the supplier for providing an empty result
      Returns:
      the created DeleteReturningCommand object
    • createInsertReturningCommand

      default <RESULT> InsertReturningCommand<RESULT> createInsertReturningCommand(Method method, InsertQuery query, ResultSetHandler<RESULT> resultSetHandler, Supplier<RESULT> emptyResultSupplier)
      Creates an InsertReturningCommand object.
      Parameters:
      method - the DAO method
      query - the query
      resultSetHandler - the result set handler
      Returns:
      the command
    • createUpdateReturningCommand

      default <RESULT> UpdateReturningCommand<RESULT> createUpdateReturningCommand(Method method, UpdateQuery query, ResultSetHandler<RESULT> resultSetHandler, Supplier<RESULT> emptyResultSupplier)
      Creates an UpdateReturningCommand object.
      Type Parameters:
      RESULT - the result type of the command
      Parameters:
      method - the DAO method
      query - the update query
      resultSetHandler - the handler for processing the result set
      emptyResultSupplier - the supplier for providing an empty result
      Returns:
      the created UpdateReturningCommand object
    • createBatchDeleteCommand

      default BatchDeleteCommand createBatchDeleteCommand(Method method, BatchDeleteQuery query)
      Creates a BatchDeleteCommand object.
      Parameters:
      method - the DAO method
      query - the query
      Returns:
      the command
    • createBatchInsertCommand

      default BatchInsertCommand createBatchInsertCommand(Method method, BatchInsertQuery query)
      Creates a BatchInsertCommand object.
      Parameters:
      method - the DAO method
      query - the query
      Returns:
      the command
    • createBatchUpdateCommand

      default BatchUpdateCommand createBatchUpdateCommand(Method method, BatchUpdateQuery query)
      Creates a BatchUpdateCommand object.
      Parameters:
      method - the DAO method
      query - the query
      Returns:
      the command
    • createFunctionCommand

      default <RESULT> FunctionCommand<RESULT> createFunctionCommand(Method method, FunctionQuery<RESULT> query)
      Creates a FunctionCommand object.
      Type Parameters:
      RESULT - the result type of the command
      Parameters:
      method - the DAO method
      query - the query
      Returns:
      the command
    • createProcedureCommand

      default ProcedureCommand createProcedureCommand(Method method, ProcedureQuery query)
      Creates a ProcedureCommand object.
      Parameters:
      method - the DAO method
      query - the query
      Returns:
      the command
    • createCreateCommand

      default <RESULT> CreateCommand<RESULT> createCreateCommand(Method method, CreateQuery<RESULT> query)
      Creates a CreateCommand object.
      Type Parameters:
      RESULT - the result type of the command
      Parameters:
      method - the DAO method
      query - the query
      Returns:
      the command
    • createScriptCommand

      default ScriptCommand createScriptCommand(Method method, ScriptQuery query)
      Creates a ScriptCommand object.
      Parameters:
      method - the DAO method
      query - the query
      Returns:
      the command
    • createSqlProcessorCommand

      default <RESULT> SqlProcessorCommand<RESULT> createSqlProcessorCommand(Method method, SqlProcessorQuery query, BiFunction<Config,PreparedSql,RESULT> handler)
      Creates a SqlProcessorCommand object
      Type Parameters:
      RESULT - the result type of the command
      Parameters:
      method - the DAO method
      query - the query
      handler - the SQL handler
      Returns:
      the command