Class AbstractDomNodeList<E extends DomNode>

  • Type Parameters:
    E - The element type
    All Implemented Interfaces:
    java.io.Serializable, java.lang.Iterable<E>, java.util.Collection<E>, java.util.List<E>, DomNodeList<E>, org.w3c.dom.NodeList

    public abstract class AbstractDomNodeList<E extends DomNode>
    extends java.util.AbstractList<E>
    implements DomNodeList<E>, java.io.Serializable
    A generic DomNodeList implementation of NodeList.
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.util.List<E> cachedElements_
      Element cache, used to avoid XPath expression evaluation as much as possible.
      private DomNode node_
      This node list's root node.
      • Fields inherited from class java.util.AbstractList

        modCount
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      E get​(int index)
      protected DomNode getDomNode()
      Returns the DOM node.
      int getLength()
      private java.util.List<E> getNodes()
      Returns the nodes in this node list, caching as necessary.
      org.w3c.dom.Node item​(int index)
      protected abstract java.util.List<E> provideElements()
      Returns the elements.
      int size()
      • Methods inherited from class java.util.AbstractList

        add, add, addAll, clear, equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, remove, removeRange, set, subList
      • Methods inherited from class java.util.AbstractCollection

        addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface java.util.Collection

        parallelStream, removeIf, stream, toArray
      • Methods inherited from interface java.lang.Iterable

        forEach
      • Methods inherited from interface java.util.List

        add, add, addAll, addAll, clear, contains, containsAll, equals, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, replaceAll, retainAll, set, sort, spliterator, subList, toArray, toArray
    • Field Detail

      • node_

        private DomNode node_
        This node list's root node.
      • cachedElements_

        private java.util.List<E extends DomNode> cachedElements_
        Element cache, used to avoid XPath expression evaluation as much as possible.
    • Constructor Detail

      • AbstractDomNodeList

        public AbstractDomNodeList​(DomNode node)
        Creates a new node list. The elements will be "calculated" using the specified XPath expression applied on the specified node.
        Parameters:
        node - the node to serve as root for the XPath expression
    • Method Detail

      • getDomNode

        protected DomNode getDomNode()
        Returns the DOM node.
        Returns:
        the DOM node
      • provideElements

        protected abstract java.util.List<E> provideElements()
        Returns the elements.
        Returns:
        the elements
      • getNodes

        private java.util.List<E> getNodes()
        Returns the nodes in this node list, caching as necessary.
        Returns:
        the nodes in this node list
      • size

        public int size()
        Specified by:
        size in interface java.util.Collection<E extends DomNode>
        Specified by:
        size in interface java.util.List<E extends DomNode>
        Specified by:
        size in class java.util.AbstractCollection<E extends DomNode>
      • getLength

        public int getLength()
        Specified by:
        getLength in interface org.w3c.dom.NodeList
      • item

        public org.w3c.dom.Node item​(int index)
        Specified by:
        item in interface org.w3c.dom.NodeList
      • get

        public E get​(int index)
        Specified by:
        get in interface java.util.List<E extends DomNode>
        Specified by:
        get in class java.util.AbstractList<E extends DomNode>