Interface Saveable<T extends Memento>

Type Parameters:
T - The type of memento used for saving state
All Known Implementing Classes:
Bouncer, Exit, FreezeTrap, GarlicTrap, Heart, Junkie, Key, Player, Tourist

public interface Saveable<T extends Memento>
Interface for objects that can be saved and loaded using the Memento pattern.
  • Method Summary

    Modifier and Type
    Method
    Description
    Creates a memento capturing the current state of this object.
    void
    loadFromMemento(T memento)
    Restores the object's state from a memento.
  • Method Details

    • getMemento

      T getMemento()
      Creates a memento capturing the current state of this object.
      Returns:
      A memento containing the object's state
    • loadFromMemento

      void loadFromMemento(T memento)
      Restores the object's state from a memento.
      Parameters:
      memento - The memento containing the state to restore