public interface IMemento
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 that doesn't start
with a number. eg: [A-Za-z][A-Za-z0-9]* Using '.' is unsupported. However,
the value of TAG_ID is reserved for internal use.
The default implementation can throw a DOMException for createChild
and put operations. See XMLMemento.
This interface is not intended to be implemented or extended by clients.
IPersistableElement,
IElementFactory,
XMLMemento| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
TAG_ID
Special reserved key used to store the memento id
(value
"IMemento.internal.id"). |
| Modifier and Type | Method and Description |
|---|---|
IMemento |
createChild(java.lang.String type)
Creates a new child of this memento with the given type.
|
IMemento |
createChild(java.lang.String type,
java.lang.String id)
Creates a new child of this memento with the given type and id.
|
java.lang.String[] |
getAttributeKeys()
Returns an array of all the attribute keys of the memento.
|
java.lang.Boolean |
getBoolean(java.lang.String key)
Returns the boolean value of the given key.
|
IMemento |
getChild(java.lang.String type)
Returns the first child with the given type id.
|
IMemento[] |
getChildren()
Returns all children of this node.
|
IMemento[] |
getChildren(java.lang.String type)
Returns all children with the given type id.
|
java.lang.Float |
getFloat(java.lang.String key)
Returns the floating point value of the given key.
|
java.lang.String |
getID()
Returns the id for this memento.
|
java.lang.Integer |
getInteger(java.lang.String key)
Returns the integer value of the given key.
|
java.lang.String |
getString(java.lang.String key)
Returns the string value of the given key.
|
java.lang.String |
getTextData()
Returns the data of the Text node of the memento.
|
java.lang.String |
getType()
Returns the type for this memento.
|
void |
putBoolean(java.lang.String key,
boolean value)
Sets the value of the given key to the given boolean value.
|
void |
putFloat(java.lang.String key,
float value)
Sets the value of the given key to the given floating point number.
|
void |
putInteger(java.lang.String key,
int value)
Sets the value of the given key to the given integer.
|
void |
putMemento(IMemento memento)
Copy the attributes and children from
memento
to the receiver. |
void |
putString(java.lang.String key,
java.lang.String value)
Sets the value of the given key to the given string.
|
void |
putTextData(java.lang.String data)
Sets the memento's Text node to contain the given data.
|
static final java.lang.String TAG_ID
"IMemento.internal.id").getID(),
Constant Field ValuesIMemento createChild(java.lang.String type)
The getChild and getChildren methods
are used to retrieve children of a given type.
type - the typegetChild(java.lang.String),
getChildren()IMemento createChild(java.lang.String type, java.lang.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()IMemento getChild(java.lang.String type)
type - the type idnull
.IMemento[] getChildren()
null. If there are no children, an array of length
zero will be returned.IMemento[] getChildren(java.lang.String type)
type - the type idnull. If there are no keys, an array of length zero
will be returned.java.lang.Float getFloat(java.lang.String key)
key - the keynull if the key was not found or was found
but was not a floating point numberjava.lang.String getType()
createChild(java.lang.String),
createChild(java.lang.String,java.lang.String)java.lang.String getID()
null if nonecreateChild(java.lang.String,java.lang.String)java.lang.Integer getInteger(java.lang.String key)
key - the keynull if the key was not found or was found
but was not an integerjava.lang.String getString(java.lang.String key)
key - the keynull if the key was not foundjava.lang.Boolean getBoolean(java.lang.String key)
key - the keynull if the key was not foundjava.lang.String getTextData()
null
if the memento has no Text node.java.lang.String[] getAttributeKeys()
null. If there are no keys, an array of length zero will
be returned.void putFloat(java.lang.String key,
float value)
key - the keyvalue - the valuevoid putInteger(java.lang.String key,
int value)
key - the keyvalue - the valuevoid putMemento(IMemento memento)
memento
to the receiver.memento - the IMemento to be copied.void putString(java.lang.String key,
java.lang.String value)
key - the keyvalue - the valuevoid putBoolean(java.lang.String key,
boolean value)
key - the keyvalue - the valuevoid putTextData(java.lang.String data)
data - the data to be placed on the Text node
Copyright (c) 2000, 2018 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.