public interface StateEditable
StateEdit
action.
The following example shows how to write a class that implements this interface.
class Foo implements StateEditable { private String name; public void setName(String n) { name = n; } public void restoreState(Hashtable h) { if (h.containsKey("name")) setName((String) h.get("name")); } public void storeState(Hashtable s) { s.put("name", name); } }
StateEdit
Modifier and Type | Field and Description |
---|---|
static String |
RCSID
The ID of the Java source file in Sun’s Revision Control
System (RCS).
|
Modifier and Type | Method and Description |
---|---|
void |
restoreState(Hashtable<?,?> state)
Performs an edit action, taking any editable state information
from the specified hash table.
|
void |
storeState(Hashtable<Object,Object> state)
Stores any editable state information into the specified hash
table.
|
static final String RCSID
void restoreState(Hashtable<?,?> state)
Note to implementors of this interface: To increase
efficiency, the StateEdit
class StateEdit.removeRedundantState()
removes redundant state
information. Therefore, implementations of this interface must be
prepared for the case where certain keys were stored into the
table by storeState(java.util.Hashtable<java.lang.Object, java.lang.Object>)
, but are not present anymore
when the restoreState
method gets called.
state
- a hash table containing the relevant state
information.void storeState(Hashtable<Object,Object> state)
state
- a hash table for storing relevant state
information.