Class FilteringNodeIterator

java.lang.Object
org.apache.jackrabbit.commons.iterator.FilteringNodeIterator
All Implemented Interfaces:
Iterator, NodeIterator, RangeIterator

public class FilteringNodeIterator extends Object implements NodeIterator
A wrapper around a NodeIterator filtering out nodes from the base iterator that don't match the specified filter. Due to the nature of the filter mechanism the size if the iterator may shrink upon iteration.
  • Constructor Details

  • Method Details

    • hasNext

      public boolean hasNext()
      Specified by:
      hasNext in interface Iterator
      See Also:
    • next

      public Object next()
      Specified by:
      next in interface Iterator
      See Also:
    • remove

      public void remove()
      Specified by:
      remove in interface Iterator
      See Also:
    • nextNode

      public Node nextNode()
      Description copied from interface: NodeIterator
      Returns the next Node in the iteration.
      Specified by:
      nextNode in interface NodeIterator
      Returns:
      the next Node in the iteration.
      See Also:
    • skip

      public void skip(long skipNum)
      Description copied from interface: RangeIterator
      Skip a number of elements in the iterator.
      Specified by:
      skip in interface RangeIterator
      Parameters:
      skipNum - the non-negative number of elements to skip
      See Also:
    • getSize

      public long getSize()
      Description copied from interface: RangeIterator
      Returns the total number of of items available through this iterator. For example, for some node N, N.getNodes().getSize() returns the number of child nodes of N visible through the current Session. In some implementations precise information about the number of elements may not be available. In such cases this method must return -1. API clients will then be able to use RangeIterator.getNumberRemaining to get an estimate on the number of elements.
      Specified by:
      getSize in interface RangeIterator
      Returns:
      a long
      See Also:
    • getPosition

      public long getPosition()
      Description copied from interface: RangeIterator
      Returns the current position within the iterator. The number returned is the 0-based index of the next element in the iterator, i.e. the one that will be returned on the subsequent next call.

      Note that this method does not check if there is a next element, i.e. an empty iterator will always return 0.

      Specified by:
      getPosition in interface RangeIterator
      Returns:
      a long
      See Also: