Interface ICommandInterceptor
public interface ICommandInterceptor
An interface for stackable command interceptors, which can extend
and modify the command call chain.
This mechanism can be used for authentication, logging, and other functions.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionexecute
(String correlationId, ICommand command, Parameters args) Executes the wrapped command with specified arguments.Gets the name of the wrapped command.validate
(ICommand command, Parameters args) Validates arguments of the wrapped command before its execution.
-
Method Details
-
getName
Gets the name of the wrapped command.The interceptor can use this method to override the command name. Otherwise it shall just delegate the call to the wrapped command.
- Parameters:
command
- the next command in the call chain.- Returns:
- the name of the wrapped command.
-
execute
Executes the wrapped command with specified arguments.The interceptor can use this method to intercept and alter the command execution. Otherwise it shall just delete the call to the wrapped command.
- Parameters:
correlationId
- optional transaction id to trace calls across components.command
- the next command in the call chain that is to be executed.args
- the parameters (arguments) to pass to the command for execution.- Returns:
- execution result.
- Throws:
ApplicationException
- when execution fails for whatever reason.- See Also:
-
validate
Validates arguments of the wrapped command before its execution.The interceptor can use this method to intercept and alter validation of the command arguments. Otherwise it shall just delegate the call to the wrapped command.
- Parameters:
command
- the next command in the call chain to be validated against.args
- the parameters (arguments) to validate.- Returns:
- an list of ValidationResults.
- See Also:
-