public interface Memento
Mementos were designed with the following requirements in mind:
Mementos meet these requirements by providing support for storing a mapping of arbitrary string keys to primitive values, and by allowing mementos to have other mementos as children (arranged into a tree). A robust external storage format based on XML is used.
The key for an attribute may be any alpha numeric value. However, the
value of TAG_ID
is reserved for internal use.
This interface is not intended to be implemented or extended by clients.
Modifier and Type | Field and Description |
---|---|
static String |
TAG_ID
Special reserved key used to store the memento id
(value
"org.eclipse.ui.id" ). |
Modifier and Type | Method and Description |
---|---|
Memento |
createChild(String type)
Creates a new child of this memento with the given type.
|
Memento |
createChild(String type,
String id)
Creates a new child of this memento with the given type and id.
|
Boolean |
getBoolean(String key)
Returns the boolean value of the given key.
|
Memento |
getChild(String type)
Returns the first child with the given type id.
|
Memento[] |
getChildren(String type)
Returns all children with the given type id.
|
Float |
getFloat(String key)
Returns the floating point value of the given key.
|
String |
getID()
Returns the id for this memento.
|
Integer |
getInteger(String key)
Returns the integer value of the given key.
|
String |
getString(String key)
Returns the string value of the given key.
|
String |
getTextData()
Returns the data of the Text node of the memento.
|
void |
putBoolean(String key,
boolean value)
Sets the value of the given key to the given boolean.
|
void |
putFloat(String key,
float value)
Sets the value of the given key to the given floating point number.
|
void |
putInteger(String key,
int value)
Sets the value of the given key to the given integer.
|
void |
putMemento(Memento memento)
Copy the attributes and children from
memento
to the receiver. |
void |
putString(String key,
String value)
Sets the value of the given key to the given string.
|
void |
putTextData(String data)
Sets the memento's Text node to contain the given data.
|
static final String TAG_ID
"org.eclipse.ui.id"
).getID()
,
Constant Field ValuesMemento createChild(String type)
The getChild
and getChildren
methods
are used to retrieve children of a given type.
type
- the typegetChild(java.lang.String)
,
getChildren(java.lang.String)
Memento createChild(String type, String id)
TAG_ID
) and can be retrieved using getId
.
The getChild
and getChildren
methods are
used to retrieve children of a given type.
type
- the typeid
- the child idgetID()
Memento getChild(String type)
type
- the type idMemento[] getChildren(String type)
type
- the type idFloat getFloat(String key)
key
- the keynull
if the key was not found or was
found but was not a floating point numberString getID()
null
if nonecreateChild(String, String)
Integer getInteger(String key)
key
- the keynull
if the key was not found or was
found but was not an integerBoolean getBoolean(String key)
key
- the keynull
if the key was not found or was
found but was not an integerString getString(String key)
key
- the keynull
if the key was not foundString getTextData()
null
if the memento has no Text node.void putFloat(String key, float value)
key
- the keyvalue
- the valuevoid putInteger(String key, int value)
key
- the keyvalue
- the valuevoid putMemento(Memento memento)
memento
to the receiver.memento
- the Memento to be copied.void putString(String key, String value)
key
- the keyvalue
- the valuevoid putBoolean(String key, boolean value)
key
- the keyvalue
- the valuevoid putTextData(String data)
data
- the data to be placed on the Text nodeCopyright © 2011 Nuxeo SA. All Rights Reserved.