Interface Command

  • All Known Implementing Classes:
    NoCommand

    public interface Command
    Command to be executed in database like Select, Update, Delete, Insert, Stored Procedure...
    Since:
    0.6.0
    Author:
    Alisson Gomes
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      <T> T execute()
      Execute the database statement could be a Command or a Query
      Command with​(net.sf.jkniv.exception.HandleableException handlerException)
      Configure the handler exception for the command
      Command with​(CommandHandler commandHandler)
      Configure the life-cycle of command
      <T> Command with​(T stmt)
      The statement to run this command
    • Method Detail

      • with

        Command with​(net.sf.jkniv.exception.HandleableException handlerException)
        Configure the handler exception for the command
        Parameters:
        handlerException - rules to handler the all exceptions
        Returns:
        a reference to this object.
      • with

        Command with​(CommandHandler commandHandler)
        Configure the life-cycle of command
        Parameters:
        commandHandler - the life-cycle of command handler
        Returns:
        a reference to this object.
      • with

        <T> Command with​(T stmt)
        The statement to run this command
        Type Parameters:
        T - Type responsible to execute the statement into database. For example: Statement for JDBC or Cassandra, EntityManager for JPA, bucket for Couchbase etc
        Parameters:
        stmt - a statement implementation to run the command.
        Returns:
        a reference to this object.
      • execute

        <T> T execute()
        Execute the database statement could be a Command or a Query
        Type Parameters:
        T - Generic type of return, example: rows affected by a command or list of objects.
        Returns:
        the result of the statement execution