Package net.sf.jkniv.whinstone.commands
Interface CommandHandler
-
- All Known Implementing Classes:
DefaultCommandHandler,DefaultQueryHandler,NoCommandHandler
public interface CommandHandler- Since:
- 0.6.0
- Author:
- Alisson Gomes
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description CommandasCommand()Retrieve the command implementation for the Repository like: Update, Select, Batch etcCommandHandlercheckSqlType(net.sf.jkniv.sqlegance.SqlType expected)If the command isn't the SQL type expected an illegal argument exception is throw.CommandHandlerpostCallback()Invoke all post callback methods configured for the parameters ofQueryableCommandHandlerpostCommit()Invoke all post callback methods, configured to be executed after a successful commit, for the parameters ofQueryable.CommandHandlerpostException()Invoke all post callback methods, configured to be executed after a failure, for the parameters ofQueryable.CommandHandlerpreCallback()Invoke all pre callback methods configured for the parameters ofQueryable<T> Trun()Execute the database commandCommandHandlerwith(net.sf.jkniv.exception.HandleableException handlerException)Configure the life-cycle with the handler exceptionCommandHandlerwith(net.sf.jkniv.sqlegance.Sql sql)Configure the life-cycle with aSqlCommandHandlerwith(Queryable queryable)Configure the life-cycle with aQueryableCommandHandlerwith(ResultRow<?,?> customResultRow)Configure the life-cycle with a custom result parser rows of query.
-
-
-
Method Detail
-
with
CommandHandler with(Queryable queryable)
Configure the life-cycle with aQueryable- Parameters:
queryable- query name and yours parameters- Returns:
- a reference to this object.
-
with
CommandHandler with(net.sf.jkniv.sqlegance.Sql sql)
Configure the life-cycle with aSql- Parameters:
sql- Dynamic SQL- Returns:
- a reference to this object.
-
with
CommandHandler with(ResultRow<?,?> customResultRow)
Configure the life-cycle with a custom result parser rows of query.- Parameters:
customResultRow- customized result row to parser- Returns:
- a reference to this object.
-
with
CommandHandler with(net.sf.jkniv.exception.HandleableException handlerException)
Configure the life-cycle with the handler exception- Parameters:
handlerException- rules to handler the all exceptions- Returns:
- a reference to this object.
-
asCommand
Command asCommand()
Retrieve the command implementation for the Repository like: Update, Select, Batch etc- Returns:
- the specific implementation for the command.
-
preCallback
CommandHandler preCallback()
Invoke all pre callback methods configured for the parameters ofQueryable- Returns:
- a reference to this object.
-
postCallback
CommandHandler postCallback()
Invoke all post callback methods configured for the parameters ofQueryable- Returns:
- a reference to this object.
-
postCommit
CommandHandler postCommit()
Invoke all post callback methods, configured to be executed after a successful commit, for the parameters ofQueryable.- Returns:
- a reference to this object.
-
postException
CommandHandler postException()
Invoke all post callback methods, configured to be executed after a failure, for the parameters ofQueryable.- Returns:
- a reference to this object.
-
run
<T> T run()
Execute the database command- Type Parameters:
T- Generic type of return, example: rows affected by a command or list of objects.- Returns:
- the result of the command execution
-
checkSqlType
CommandHandler checkSqlType(net.sf.jkniv.sqlegance.SqlType expected)
If the command isn't the SQL type expected an illegal argument exception is throw.- Parameters:
expected- type of SQL expected- Returns:
- a reference to this object.
- Throws:
IllegalArgumentException- ifSqlisn't the expectedSqlType
-
-