Select Page

Command

Command

Encapsulate a request as an object, thereby letting you parameterize clients with different requests, queue or log requests, and support undoable operations. Builds an undo/redo manager and a set of  command classes.

Source Code

/**  * Declares an interface for executing an operation  * @role __Command  */ public interface Command {         /** this method is called by client to execute this command */         void executeCommand();}  /**  * Defines a binding betweeen a Receiver object and an action.   * Implements Command by invoking the corresponding operation(s) on Receiver  */ public class CommandA implements Command {         public CommandA() {                 // put command initialization code here         }          /** @see patterns.gof.command.Command#executeCommand()*/         public void executeCommand() {                 // provide implementation here         } }  /**  * Defines a binding betweeen a Receiver object and an action.   * Implements Command by invoking the corresponding operation(s) on Receiver  */ public class CommandB implements Command {         public CommandB() {                 // put command initialization code here         }          /** @see patterns.gof.command.Command#executeCommand()*/         public void executeCommand() {                 // provide implementation here         } }  /**  * Concrete Command that executes a sequence of Commands.  */ public class MacroCommand implements Command {         /** Commands to execute */         private Command[] commands;        /** @param commands Commands to execute */         public MacroCommand(Command[] commands) {                 this.commands = commands;        }          /** Executes sequence of Commands */         public void executeCommand() {                 if (commands != null) {                         for (int i = 0; i < commands.length; i++) {                                 commands[i].executeCommand();                        }                 }         }  }  

About The Author

Cédric Walter

I worked with various Insurances companies across Switzerland on online applications handling billion premium volumes. I love to continuously spark my creativity in many different and challenging open-source projects fueled by my great passion for innovation and blockchain technology. In my technical role as a senior software engineer and Blockchain consultant, I help to define and implement innovative solutions in the scope of both blockchain and traditional products, solutions, and services. I can support the full spectrum of software development activities, starting from analyzing ideas and business cases and up to the production deployment of the solutions. I'm the Founder and CEO of Disruptr GmbH.

Categories

brands

 
 
Cordalo simplify writing Corda applications.
 
tokens-economy.com is a blog / digital playground where Cédric keep track of new developments in the distributed ledger technology space and present all his experimentation and tools, promoting the understanding of digital currencies and assets.
 
Galaxiis premium joomla extensions and plugins
 
Supercars-central.com is a blog about the Audi R8 Spyder V10 and more...