Interface Restorable

All Known Subinterfaces:
Figure, FigureCollection, FigureSelection, Handle, PointFigure, ShapeFigure
All Known Implementing Classes:
AbstractFigure, AbstractHandle, AbstractPointFigure, AbstractShapeFigure, DefaultFigureCollection, DefaultFigureSelection, DefaultPointFigure, DefaultShapeFigure, PointHandle, RotateHandle, ScaleHandle, VertexHandle

public interface Restorable
An object implementing this interface can create a memento by which it's state can be restored after the object has been changed.

The interface is used to realize the GoF Memento Design Pattern.

Since:
Ceres 0.10
  • Method Summary

    Modifier and Type
    Method
    Description
    Creates a memento which contains all state information used to restore this object at a later point in time by calling setMemento(memento).
    void
    setMemento(Object memento)
    Restores this object's state from the given memento object.
  • Method Details

    • createMemento

      Object createMemento()
      Creates a memento which contains all state information used to restore this object at a later point in time by calling setMemento(memento).
      Returns:
      A memento, or null if a memento cannot be created.
    • setMemento

      void setMemento(Object memento)
      Restores this object's state from the given memento object.

      This method will always (at least) accept the memento objects created by the createMemento() method.

      Parameters:
      memento - A memento object.