public interface CommandHandler<CommandT extends Command<CommandResponseT>,CommandResponseT extends CommandResponse>
CommandHandler interface defines methods which allow its implementations to do the actual
work of processing a concrete type of Command implementation and produce a response that
is a concerete implementation of CommandResponse.
Clients of this framework should implement a concrete implementation of this interface for each
distinct type of Command/CommandResponse pair.
Warning! Implementations of this interface must account for the fact that the execution of its code might happen in a multi-threaded environment. Do NOT assume that a new instance of this handler will be created for each thread. In other words, multiple threads might share the same instance of the handler.
| Modifier and Type | Method and Description |
|---|---|
CommandResponseT |
execute(CommandT command)
Executes the
command, producing command response of class type which is embedded
in the type of command. |
Class<CommandT> |
getCompatibleCommandClassType()
Retrieves class type of the command this handler is to able to process.
|
Class<CommandResponseT> |
getCompatibleCommandResponseClassType()
Retrieves class type of the command response this handler is set to return.
|
String |
getCompatibleCommandType()
Retrieves command type identifier that this handler is able to process.
|
CommandResponseT execute(CommandT command)
command, producing command response of class type which is embedded
in the type of command.command - Command object containing data which is needed for execution this command.command.String getCompatibleCommandType()
Command interface.Class<CommandT> getCompatibleCommandClassType()
Class<CommandResponseT> getCompatibleCommandResponseClassType()
Copyright © 2018. All rights reserved.