|
||||||||||
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.
public NodeList(Element element)
Element
node.
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
public void add(int index, Object o)
add
in interface List
public boolean addAll(Collection c)
addAll
in interface Collection
addAll
in interface List
public boolean addAll(int index, Collection c)
addAll
in interface List
public void clear()
clear
in interface Collection
clear
in interface List
public boolean contains(Object o)
contains
in interface Collection
contains
in interface List
public boolean containsAll(Collection c)
containsAll
in interface Collection
containsAll
in interface List
public Object get(int index)
get
in interface List
public int indexOf(Object o)
indexOf
in interface List
public boolean isEmpty()
isEmpty
in interface Collection
isEmpty
in interface List
public Iterator iterator()
iterator
in interface Iterable
iterator
in interface Collection
iterator
in interface List
public int lastIndexOf(Object o)
lastIndexOf
in interface List
public ListIterator listIterator()
listIterator
in interface List
public ListIterator listIterator(int index)
listIterator
in interface List
public Object remove(int index)
remove
in interface List
public boolean remove(Object o)
remove
in interface Collection
remove
in interface List
public boolean removeAll(Collection c)
removeAll
in interface Collection
removeAll
in interface List
public boolean retainAll(Collection c)
retainAll
in interface Collection
retainAll
in interface List
public Object set(int index, Object o)
set
in interface List
public int size()
size
in interface Collection
size
in interface List
public List subList(int fromIndex, int toIndex)
subList
in interface List
public Object[] toArray()
toArray
in interface Collection
toArray
in interface List
public Object[] toArray(Object[] a)
toArray
in interface Collection
toArray
in interface List
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |