[디자인 패턴] - Memento
볼빵빵오춘기
Memento객체의 이전 상태를 저장해 두었다가, 필요할 때 그 상태로 복원(rollback) 할 수 있도록 해주는 디자인 패턴이다. 예시 코드// 상태를 저장할 Memento 클래스class Memento { private final String state; public Memento(String state) { this.state = state; } public String getState() { return state; }}// 상태를 가지고 있는 Originator 클래스class Originator { private String state; public void setState(String state) { this.sta..