public class NodeList
extends java.lang.Object
implements java.util.List, java.lang.Cloneable
toString() method that will output the XML serialized form of the
nodes it contains - again focusing on template engine usage, as well as the
selectNodes(String) method that helps selecting a different set of nodes
starting from the nodes in this list. The class also implements the List
interface by simply delegating calls to the contained list (the subList(int, int)
method is implemented by delegating to the contained list and wrapping the returned
sublist into a NodeList).| Modifier and Type | Class and Description |
|---|---|
private static class |
NodeList.AttributeXMLOutputter
A special subclass of XMLOutputter that will be used to output
Attribute nodes.
|
| Modifier and Type | Field and Description |
|---|---|
private static NodeList.AttributeXMLOutputter |
DEFAULT_OUTPUTTER |
private java.util.List |
nodes
The contained nodes
|
| Modifier | Constructor and Description |
|---|---|
|
NodeList()
Creates an empty node list.
|
|
NodeList(org.jdom.Document document)
Creates a node list that holds a single
Document node. |
|
NodeList(org.jdom.Element element)
Creates a node list that holds a single
Element node. |
|
NodeList(java.util.List nodes)
Creates a node list that holds a list of nodes.
|
|
NodeList(java.util.List nodes,
boolean copy)
Creates a node list that holds a list of nodes.
|
private |
NodeList(java.lang.Object object) |
| Modifier and Type | Method and Description |
|---|---|
void |
add(int index,
java.lang.Object o) |
boolean |
add(java.lang.Object o) |
boolean |
addAll(java.util.Collection c) |
boolean |
addAll(int index,
java.util.Collection c) |
void |
clear() |
java.lang.Object |
clone()
Returns a NodeList that contains the same nodes as this node list.
|
private void |
cloneNodes() |
boolean |
contains(java.lang.Object o) |
boolean |
containsAll(java.util.Collection c) |
boolean |
equals(java.lang.Object o)
Tests for equality with another object.
|
java.lang.Object |
get(int index) |
java.util.List |
getList()
Retrieves the underlying list used to store the nodes.
|
int |
hashCode()
Returns the hash code of the contained list.
|
int |
indexOf(java.lang.Object o) |
boolean |
isEmpty() |
java.util.Iterator |
iterator() |
int |
lastIndexOf(java.lang.Object o) |
java.util.ListIterator |
listIterator() |
java.util.ListIterator |
listIterator(int index) |
java.lang.Object |
remove(int index) |
boolean |
remove(java.lang.Object o) |
boolean |
removeAll(java.util.Collection c) |
boolean |
retainAll(java.util.Collection c) |
NodeList |
selectNodes(java.lang.String xpathString)
Applies an XPath expression to the node list and returns the resulting
node list.
|
java.lang.Object |
set(int index,
java.lang.Object o) |
int |
size() |
java.util.List |
subList(int fromIndex,
int toIndex) |
java.lang.Object[] |
toArray() |
java.lang.Object[] |
toArray(java.lang.Object[] a) |
java.lang.String |
toString()
This method returns the string resulting from concatenation of string
representations of its nodes.
|
private static final NodeList.AttributeXMLOutputter DEFAULT_OUTPUTTER
private java.util.List nodes
public NodeList()
public NodeList(org.jdom.Document document)
Document node.public NodeList(org.jdom.Element element)
Element node.private NodeList(java.lang.Object object)
public NodeList(java.util.List nodes)
nodes - the list of nodes this template should hold. The created
template will copy the passed nodes list, so changes to the passed list
will not affect the model.public NodeList(java.util.List nodes,
boolean copy)
nodes - the list of nodes this template should hold.copy - if true, the created template will copy the passed nodes
list, so changes to the passed list will not affect the model. If false,
the model will reference the passed list and will sense changes in it,
altough no operations on the list will be synchronized.public java.util.List getList()
List interface
of this class itself. You would probably access the underlying list only for
synchronization purposes.public java.lang.String toString()
toString in class java.lang.Objectpublic java.lang.Object clone()
throws java.lang.CloneNotSupportedException
clone in class java.lang.Objectjava.lang.CloneNotSupportedException - if the contained list's class does
not have an accessible no-arg constructor.private void cloneNodes()
throws java.lang.CloneNotSupportedException
java.lang.CloneNotSupportedExceptionpublic int hashCode()
hashCode in interface java.util.CollectionhashCode in interface java.util.ListhashCode in class java.lang.Objectpublic boolean equals(java.lang.Object o)
equals in interface java.util.Collectionequals in interface java.util.Listequals in class java.lang.Objecto - the object to test for equalityList objects evaluate as equals.public NodeList selectNodes(java.lang.String xpathString)
xpathExpression - the XPath expression you wish to applypublic boolean add(java.lang.Object o)
add in interface java.util.Collectionadd in interface java.util.Listpublic void add(int index,
java.lang.Object o)
add in interface java.util.Listpublic boolean addAll(java.util.Collection c)
addAll in interface java.util.CollectionaddAll in interface java.util.Listpublic boolean addAll(int index,
java.util.Collection c)
addAll in interface java.util.Listpublic void clear()
clear in interface java.util.Collectionclear in interface java.util.Listpublic boolean contains(java.lang.Object o)
contains in interface java.util.Collectioncontains in interface java.util.Listpublic boolean containsAll(java.util.Collection c)
containsAll in interface java.util.CollectioncontainsAll in interface java.util.Listpublic java.lang.Object get(int index)
get in interface java.util.Listpublic int indexOf(java.lang.Object o)
indexOf in interface java.util.Listpublic boolean isEmpty()
isEmpty in interface java.util.CollectionisEmpty in interface java.util.Listpublic java.util.Iterator iterator()
iterator in interface java.lang.Iterableiterator in interface java.util.Collectioniterator in interface java.util.Listpublic int lastIndexOf(java.lang.Object o)
lastIndexOf in interface java.util.Listpublic java.util.ListIterator listIterator()
listIterator in interface java.util.Listpublic java.util.ListIterator listIterator(int index)
listIterator in interface java.util.Listpublic java.lang.Object remove(int index)
remove in interface java.util.Listpublic boolean remove(java.lang.Object o)
remove in interface java.util.Collectionremove in interface java.util.Listpublic boolean removeAll(java.util.Collection c)
removeAll in interface java.util.CollectionremoveAll in interface java.util.Listpublic boolean retainAll(java.util.Collection c)
retainAll in interface java.util.CollectionretainAll in interface java.util.Listpublic java.lang.Object set(int index,
java.lang.Object o)
set in interface java.util.Listpublic int size()
size in interface java.util.Collectionsize in interface java.util.Listpublic java.util.List subList(int fromIndex,
int toIndex)
subList in interface java.util.Listpublic java.lang.Object[] toArray()
toArray in interface java.util.CollectiontoArray in interface java.util.Listpublic java.lang.Object[] toArray(java.lang.Object[] a)
toArray in interface java.util.CollectiontoArray in interface java.util.ListCopyright ? 2002 Apache Software Foundation. All Rights Reserved.