T
- The type of XmlTreepublic class XmlTree<T> extends Object implements StringTree<T>
Modifier and Type | Method and Description |
---|---|
Map<String,StringTree<T>> |
getChildMap()
Get a map of all direct subtrees, assuming that all subtrees are uniquely named.
|
Map<String,List<StringTree<T>>> |
getChildMultimap()
Get a map of all the children of this node.
|
Map<String,T> |
getLeafMap()
Get a map of the names and values of all subtrees, assuming that all subtrees are leafs and are uniquely named.
|
Map<String,List<T>> |
getLeafMultimap()
Get a multimap of the names and values of all subtrees, assuming that all subtrees are leafs.
|
static StringTree<String> |
getStringTree(org.dom4j.Node n)
Returns a StringTree<String> view of the given XML node.
|
StringTree<T> |
getSubTree(String name)
Get the only subtree with the given name.
|
List<StringTree<T>> |
getSubTrees(String name)
Get the named subtrees.
|
T |
getValue()
Get the value of a leaf.
|
T |
getValue(String name)
Get the value of a named sub-leaf.
|
boolean |
isLeaf()
Returns true if this object is a leaf, and thus if getValue is legal.
|
public static StringTree<String> getStringTree(org.dom4j.Node n)
n
- A part of an XML document structureArgumentNotValid
- on null argument.public boolean isLeaf()
isLeaf
in interface StringTree<T>
public T getValue(String name)
getValue
in interface StringTree<T>
name
- Name of the sub-leaf to get the value of. These are strings, and as a shorthand may specify subtrees
of subtrees by separating each level with '.', i.e. getSubtrees("subtree.subsubtree").IllegalState
- if this StringTree does not have exactly one leaf sub-node with the given name.ArgumentNotValid
- if argument is null or empty.public T getValue()
getValue
in interface StringTree<T>
IllegalState
- if this Tree is a node.public StringTree<T> getSubTree(String name)
getSubTree
in interface StringTree<T>
name
- The name of the subtree. These are strings, and as a shorthand may specify subtrees of subtrees by
separating each level with '.', i.e. getSubtrees("subtree.subsubtree").IllegalState
- if this object is a leaf, or there is not exactly one subtree with the given name.ArgumentNotValid
- if argument is null or empty.public List<StringTree<T>> getSubTrees(String name)
getSubTrees
in interface StringTree<T>
name
- The name of the subtrees. These are strings, and as a shorthand may specify subtrees of subtrees by
separating each level with '.', i.e. getSubtrees("subtree.subsubtree").IllegalState
- if this object is a leaf.ArgumentNotValid
- if argument is null or empty.public Map<String,List<StringTree<T>>> getChildMultimap()
getChildMultimap
in interface StringTree<T>
IllegalState
- if this object is a leaf.public Map<String,StringTree<T>> getChildMap()
getChildMap
in interface StringTree<T>
IllegalState
- if this object is a leaf, or if the subtrees are not uniquely named.public Map<String,List<T>> getLeafMultimap()
getLeafMultimap
in interface StringTree<T>
ArgumentNotValid
- if this object is not a node, or if any of its children are not leaves.public Map<String,T> getLeafMap()
getLeafMap
in interface StringTree<T>
IllegalState
- if this object is a leaf or if the subtrees are not uniquely named, or if any of its
children are not leaves.Copyright © 2005–2015 The Royal Danish Library, the Danish State and University Library, the National Library of France and the Austrian National Library.. All rights reserved.