public interface CompensableCommand extends Command
The CompensableCommand interface defines one method, getCompensatingCommand(), which returns the compensating command associated with a command. The application programmer must implement both this method and the compensating command itself as part of implementing a compensable command.
A client that wants to reverse a compensable command calls the compensating command like this:
myCommand.getCompensatingCommand().performExecute();
serialVersionUID
Modifier and Type | Method and Description |
---|---|
Command |
getCompensatingCommand()
Retrieves the compensating command associated with the command.
|
execute, isReadyToCallExecute, reset
Command getCompensatingCommand() throws CommandException
The application programmer implements the getCompensatingCommand method as part of writing a compensable command. For a compensating command whose input properties are the output properties of the original command, the following implementation is sufficient:
Command command = new MyCompensatingCommand(); command.setInputPropertyX(outputPropertyP); return command;
CommandException
- The superclass for all command exceptions. Specifically,
UnavailableCompensatingCommandException is thrown if there is no
compensating command associated with the command.