diff options
Diffstat (limited to 'common/src/at/gv/egovernment/moa/util/NodeListAdapter.java')
-rw-r--r-- | common/src/at/gv/egovernment/moa/util/NodeListAdapter.java | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/common/src/at/gv/egovernment/moa/util/NodeListAdapter.java b/common/src/at/gv/egovernment/moa/util/NodeListAdapter.java new file mode 100644 index 000000000..7102cadca --- /dev/null +++ b/common/src/at/gv/egovernment/moa/util/NodeListAdapter.java @@ -0,0 +1,44 @@ +package at.gv.egovernment.moa.util; + +import java.util.List; + +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; + +/** + * A <code>NodeList</code> implementation based on a <code>List</code>. + * + * @see java.util.List + * @see org.w3c.dom.NodeList + * + * @author Patrick Peck + * @version $Id$ + */ +public class NodeListAdapter implements NodeList { + /** The <code>List</code> to wrap. */ + private List nodeList; + + /** + * Create a new <code>NodeListAdapter</code>. + * + * @param nodeList The <code>List</code> containing the nodes. + */ + public NodeListAdapter(List nodeList) { + this.nodeList = nodeList; + } + + /** + * @see org.w3c.dom.NodeList#item(int) + */ + public Node item(int index) { + return (Node) nodeList.get(index); + } + + /** + * @see org.w3c.dom.NodeList#getLength() + */ + public int getLength() { + return nodeList.size(); + } + +} |