Interface Originator

All Known Subinterfaces:
CommandOriginator, Engine
All Known Implementing Classes:
CopyTextCommand, CutSelectedCommand, DeleteTextCommand, EngineImpl, InsertTextCommand, MoveSelection, PasteTextCommand

public interface Originator
The Originator interface defines methods for managing the state of an object. Any object implementing this interface can save its state into a Memento and restore its state from a Memento. This follows the Memento design pattern.
  • Method Summary

    Modifier and Type
    Method
    Description
    saves the state of the object calling this method in a memento matching the type of the object
    void
    sets the attributes of the object calling this method to match the attributes the memento
  • Method Details

    • setMemento

      void setMemento(Memento memento)
      sets the attributes of the object calling this method to match the attributes the memento
      Parameters:
      memento -
    • getMemento

      Memento getMemento()
      saves the state of the object calling this method in a memento matching the type of the object
      Returns:
      a memento of the object