Command


Usage
  • Also known as: Action; Transaction
  • Encapsulate a command request as an object
  • Encapsulate a request as an object, thereby letting you parameterize clients with different requests, queue or log requests, and support undoable operations
Diagram
Command
Participants
Command
  • Declares an interface for executing an operation
ConcreteCommand
  • Defines a binding between a Receiver object and an action
  • Implements Execute by invoking the corresponding operation(s) on Receiver
Client
  • Creates a ConcreteCommand object and sets its receiver
Invoker
  • Asks the command to carry out the request
Receiver
  • Knows how to perform the operations associated with carrying out the request.