|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.velocity.anakia.NodeList
public class NodeList
Provides a class for wrapping a list of JDOM objects primarily for use in template
engines and other kinds of text transformation tools.
It has a 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
).
Constructor Summary | |
---|---|
NodeList()
Creates an empty node list. |
|
NodeList(Document document)
Creates a node list that holds a single Document node. |
|
NodeList(Element element)
Creates a node list that holds a single Element node. |
|
NodeList(List nodes)
Creates a node list that holds a list of nodes. |
|
NodeList(List nodes,
boolean copy)
Creates a node list that holds a list of nodes. |
Method Summary | |
---|---|
void |
add(int index,
Object o)
|
boolean |
add(Object o)
|
boolean |
addAll(Collection c)
|
boolean |
addAll(int index,
Collection c)
|
void |
clear()
|
Object |
clone()
Returns a NodeList that contains the same nodes as this node list. |
boolean |
contains(Object o)
|
boolean |
containsAll(Collection c)
|
boolean |
equals(Object o)
Tests for equality with another object. |
Object |
get(int index)
|
List |
getList()
Retrieves the underlying list used to store the nodes. |
int |
hashCode()
Returns the hash code of the contained list. |
int |
indexOf(Object o)
|
boolean |
isEmpty()
|
Iterator |
iterator()
|
int |
lastIndexOf(Object o)
|
ListIterator |
listIterator()
|
ListIterator |
listIterator(int index)
|
Object |
remove(int index)
|
boolean |
remove(Object o)
|
boolean |
removeAll(Collection c)
|
boolean |
retainAll(Collection c)
|
NodeList |
selectNodes(String xpathString)
Applies an XPath expression to the node list and returns the resulting node list. |
Object |
set(int index,
Object o)
|
int |
size()
|
List |
subList(int fromIndex,
int toIndex)
|
Object[] |
toArray()
|
Object[] |
toArray(Object[] a)
|
String |
toString()
This method returns the string resulting from concatenation of string representations of its nodes. |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public NodeList()
public NodeList(Document document)
Document
node.
document
- public NodeList(Element element)
Element
node.
element
- public NodeList(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(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.Method Detail |
---|
public List getList()
List
interface
of this class itself. You would probably access the underlying list only for
synchronization purposes.
public String toString()
toString
in class Object
public Object clone() throws CloneNotSupportedException
clone
in class Object
CloneNotSupportedException
- if the contained list's class does
not have an accessible no-arg constructor.public int hashCode()
hashCode
in interface Collection
hashCode
in interface List
hashCode
in class Object
public boolean equals(Object o)
equals
in interface Collection
equals
in interface List
equals
in class Object
o
- the object to test for equality
List
objects evaluate as equals.public NodeList selectNodes(String xpathString)
xpathString
- the XPath expression you wish to apply
public boolean add(Object o)
add
in interface Collection
add
in interface List
List.add(java.lang.Object)
public void add(int index, Object o)
add
in interface List
List.add(int, java.lang.Object)
public boolean addAll(Collection c)
addAll
in interface Collection
addAll
in interface List
List.addAll(java.util.Collection)
public boolean addAll(int index, Collection c)
addAll
in interface List
List.addAll(int, java.util.Collection)
public void clear()
clear
in interface Collection
clear
in interface List
List.clear()
public boolean contains(Object o)
contains
in interface Collection
contains
in interface List
List.contains(java.lang.Object)
public boolean containsAll(Collection c)
containsAll
in interface Collection
containsAll
in interface List
List.containsAll(java.util.Collection)
public Object get(int index)
get
in interface List
List.get(int)
public int indexOf(Object o)
indexOf
in interface List
List.indexOf(java.lang.Object)
public boolean isEmpty()
isEmpty
in interface Collection
isEmpty
in interface List
List.isEmpty()
public Iterator iterator()
iterator
in interface Iterable
iterator
in interface Collection
iterator
in interface List
List.iterator()
public int lastIndexOf(Object o)
lastIndexOf
in interface List
List.lastIndexOf(java.lang.Object)
public ListIterator listIterator()
listIterator
in interface List
List.listIterator()
public ListIterator listIterator(int index)
listIterator
in interface List
List.listIterator(int)
public Object remove(int index)
remove
in interface List
List.remove(int)
public boolean remove(Object o)
remove
in interface Collection
remove
in interface List
List.remove(java.lang.Object)
public boolean removeAll(Collection c)
removeAll
in interface Collection
removeAll
in interface List
List.removeAll(java.util.Collection)
public boolean retainAll(Collection c)
retainAll
in interface Collection
retainAll
in interface List
List.retainAll(java.util.Collection)
public Object set(int index, Object o)
set
in interface List
List.set(int, java.lang.Object)
public int size()
size
in interface Collection
size
in interface List
List.size()
public List subList(int fromIndex, int toIndex)
subList
in interface List
List.subList(int, int)
public Object[] toArray()
toArray
in interface Collection
toArray
in interface List
List.toArray()
public Object[] toArray(Object[] a)
toArray
in interface Collection
toArray
in interface List
List.toArray(java.lang.Object[])
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |