public class DefaultDocumentTreeNode<V> extends Object implements DocumentTreeNode<V>
DocumentTree node.| Constructor and Description |
|---|
DefaultDocumentTreeNode(DocumentPath key,
V value,
long version,
DocumentTreeNode<V> parent) |
| Modifier and Type | Method and Description |
|---|---|
Versioned<V> |
addChild(String name,
V newValue,
long newVersion)
Adds a new child only if one does not exist with the name.
|
DocumentTreeNode<V> |
child(String name)
Returns the child node of this node with the specified relative path name.
|
Iterator<DocumentTreeNode<V>> |
children()
Returns the children of this node.
|
boolean |
equals(Object obj) |
int |
hashCode() |
DocumentTreeNode<V> |
parent() |
DocumentPath |
path()
Returns the path to this node in a
DocumentTree. |
boolean |
removeChild(String name)
Removes a child node.
|
String |
toString() |
Versioned<V> |
update(V newValue,
long newVersion)
Updates the node value.
|
Versioned<V> |
value()
Returns the value of this node.
|
clone, finalize, getClass, notify, notifyAll, wait, wait, waithasChildrenpublic DefaultDocumentTreeNode(DocumentPath key, V value, long version, DocumentTreeNode<V> parent)
public DocumentPath path()
DocumentTreeNodeDocumentTree.path in interface DocumentTreeNode<V>public Versioned<V> value()
DocumentTreeNodevalue in interface DocumentTreeNode<V>public Iterator<DocumentTreeNode<V>> children()
DocumentTreeNodechildren in interface DocumentTreeNode<V>public DocumentTreeNode<V> child(String name)
DocumentTreeNodechild in interface DocumentTreeNode<V>name - relative path name for the child node.null if no such child existspublic DocumentTreeNode<V> parent()
public Versioned<V> addChild(String name, V newValue, long newVersion)
name - relative path name of the child nodenewValue - new value to setnewVersion - new version to setnull if no child currently exists with that relative path name.
a non null return value indicates child already exists and no modification occured.public Versioned<V> update(V newValue, long newVersion)
newValue - new value to setnewVersion - new version to setpublic boolean removeChild(String name)
name - the name of child node to be removedtrue if the child set was modified as a result of this call, false otherwise