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 TypeMethodDescriptionsaves the state of the object calling this method in a memento matching the type of the objectvoid
setMemento
(Memento memento) sets the attributes of the object calling this method to match the attributes the memento
-
Method Details
-
setMemento
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
-