|
Nuxeo Enterprise Platform 5.4 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.nuxeo.common.persistence.XMLMemento
public final class XMLMemento
Implementation of the Memento
interface.
This class is not intended to be extended by clients.
Memento
Field Summary |
---|
Fields inherited from interface org.nuxeo.common.persistence.Memento |
---|
TAG_ID |
Constructor Summary | |
---|---|
XMLMemento(org.w3c.dom.Document document,
org.w3c.dom.Element element)
Creates a memento for the specified document and element. |
Method Summary | |
---|---|
Memento |
copyChild(Memento child)
|
Memento |
createChild(java.lang.String type)
Creates a new child of this memento with the given type. |
Memento |
createChild(java.lang.String type,
java.lang.String id)
Creates a new child of this memento with the given type and id. |
static XMLMemento |
createReadRoot(java.io.Reader reader)
Creates a Document from the Reader
and returns a memento on the first Element for reading
the document. |
static XMLMemento |
createReadRoot(java.io.Reader reader,
java.lang.String baseDir)
Creates a Document from the Reader and
returns a memento on the first Element for reading the
document. |
static XMLMemento |
createWriteRoot(java.lang.String type)
Returns a root memento for writing a document. |
java.lang.Boolean |
getBoolean(java.lang.String key)
Returns the boolean value of the given key. |
Memento |
getChild(java.lang.String type)
Returns the first child with the given type id. |
Memento[] |
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. |
void |
putBoolean(java.lang.String key,
boolean value)
Sets the value of the given key to the given boolean. |
void |
putFloat(java.lang.String key,
float f)
Sets the value of the given key to the given floating point number. |
void |
putInteger(java.lang.String key,
int n)
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(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. |
void |
save(java.io.Writer writer)
Saves this memento's document current values to the specified writer. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public XMLMemento(org.w3c.dom.Document document, org.w3c.dom.Element element)
Clients should use createReadRoot
and
createWriteRoot
to create the initial
memento on a document.
document
- the document for the mementoelement
- the element node for the mementoMethod Detail |
---|
public static XMLMemento createReadRoot(java.io.Reader reader) throws java.lang.Exception
Document
from the Reader
and returns a memento on the first Element
for reading
the document.
Same as calling createReadRoot(reader, null)
.
reader
- the Reader
used to create the memento's document
Element
for reading the document
java.lang.Exception
- if IO problems, invalid format, or no element.public static XMLMemento createReadRoot(java.io.Reader reader, java.lang.String baseDir) throws java.lang.Exception
Document
from the Reader
and
returns a memento on the first Element
for reading the
document.
reader
- the Reader
used to create the memento's
documentbaseDir
- the directory used to resolve relative file names in the XML
document. This directory must exist and include the trailing
separator. The directory format, including the separators,
must be valid for the platform. Can be null
if
not needed.
Element
for reading the
document
java.lang.Exception
- if IO problems, invalid format, or no element.public static XMLMemento createWriteRoot(java.lang.String type)
type
- the element node type to create on the document
public Memento createChild(java.lang.String type)
Memento
The getChild
and getChildren
methods
are used to retrieve children of a given type.
createChild
in interface Memento
type
- the type
Memento.getChild(java.lang.String)
,
Memento.getChildren(java.lang.String)
public Memento createChild(java.lang.String type, java.lang.String id)
Memento
TAG_ID
) and can be retrieved using getId
.
The getChild
and getChildren
methods are
used to retrieve children of a given type.
createChild
in interface Memento
type
- the typeid
- the child id
Memento.getID()
public Memento copyChild(Memento child)
public Memento getChild(java.lang.String type)
Memento
getChild
in interface Memento
type
- the type id
public Memento[] getChildren(java.lang.String type)
Memento
getChildren
in interface Memento
type
- the type id
public java.lang.Float getFloat(java.lang.String key)
Memento
getFloat
in interface Memento
key
- the key
null
if the key was not found or was
found but was not a floating point numberpublic java.lang.String getID()
Memento
getID
in interface Memento
null
if noneMemento.createChild(String, String)
public java.lang.Integer getInteger(java.lang.String key)
Memento
getInteger
in interface Memento
key
- the key
null
if the key was not found or was
found but was not an integerpublic java.lang.Boolean getBoolean(java.lang.String key)
Memento
getBoolean
in interface Memento
key
- the key
null
if the key was not found or was
found but was not an integerpublic java.lang.String getString(java.lang.String key)
Memento
getString
in interface Memento
key
- the key
null
if the key was not foundpublic java.lang.String getTextData()
Memento
getTextData
in interface Memento
null
if the memento has no Text node.public void putFloat(java.lang.String key, float f)
Memento
putFloat
in interface Memento
key
- the keyf
- the valuepublic void putInteger(java.lang.String key, int n)
Memento
putInteger
in interface Memento
key
- the keyn
- the valuepublic void putBoolean(java.lang.String key, boolean value)
Memento
putBoolean
in interface Memento
key
- the keyvalue
- the valuepublic void putMemento(Memento memento)
Memento
memento
to the receiver.
putMemento
in interface Memento
memento
- the Memento to be copied.public void putString(java.lang.String key, java.lang.String value)
Memento
putString
in interface Memento
key
- the keyvalue
- the valuepublic void putTextData(java.lang.String data)
Memento
putTextData
in interface Memento
data
- the data to be placed on the Text nodepublic void save(java.io.Writer writer)
writer
- the writer used to save the memento's document
|
Nuxeo Enterprise Platform 5.4 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |