CS3340:   Intro OOP and Design

 

Example Use of Command Patter in Java

Command Pattern

Encapsulates a request as an object

thereby letting you parameterize clients with different requests, queue or log requests, and support undoable operations.

Also called callback.

The Event model for Java uses this pattern.

Here are the classes:

  • ActionListener
  • ActionEvent
  • ActionEventOriginator (e.g. Button, or something else that gets clicked)

© Lynne Grewe