|Command<CTX,RET,E extends Exception>|
|Undoable<CTX,RET,E extends Exception>|
"... (in) the command pattern ... an object is used to represent and encapsulate all the information needed to call a method at a later time. This ... includes the ... method parameters ..." [Command pattern, see http://en.wikipedia.org/wiki/Command_pattern (Wikipedia)]
A command can be seen as a method and its context (variables1) all transformed to an object (e.g a method turned inside out).
Given you define a command's interface with an “execute” and an “undo” method and you strictly make use of commands: Then you easily can provide undo functionality by putting your executed commands onto a stack ...
Undoable) represents an (atomic) operation applied to a context encapsulated in an object (as of object oriented programming). Usually a command (
Undoable) also provides means to undo its operation applied before. The
Undoable) is created by a client (e.g. the business logic) and passed e.g. to a command bus for execution (or executed "manually" at required / desired time).
(a command bus implementation you can find in the "refcodes-jobbus" artifact,
Undoable(job) to be executed.
Copyright © 2015. All rights reserved.