Skip to content

Files

Latest commit

0d4a8db · Sep 30, 2017

History

History
This branch is 2288 commits behind iluwatar/java-design-patterns:master.

memento

layout title folder permalink pumlid categories tags
pattern
Memento
memento
/patterns/memento/
DSgn4OCm30NGLM00h3xR2AC3SvRiaxx2-g59zugtDgiz3qdlomNC-10vF-Lik7BF4A_388PIXrBh-J3OwUOlRuT4EssR38XRa7Ay81Lz_o11_RkaQvcf_GS0
Behavioral
Java
Gang Of Four
Difficulty-Intermediate

Also known as

Token

Intent

Without violating encapsulation, capture and externalize an object's internal state so that the object can be restored to this state later.

alt text

Applicability

Use the Memento pattern when

  • a snapshot of an object's state must be saved so that it can be restored to that state later, and
  • a direct interface to obtaining the state would expose implementation details and break the object's encapsulation

Real world examples

Credits