Class SubRequestIteratorSupport<S extends SubRequest<?>>

  • All Implemented Interfaces:
    java.util.Iterator<S>, SubRequestIterator<S>

    public class SubRequestIteratorSupport<S extends SubRequest<?>>
    extends java.lang.Object
    implements SubRequestIterator<S>
    This support class allows to implement a SubRequestIterator instance based on an Iterator that iterates on SubRequest instances.
    Version:
    3.1.0
    Author:
    Frank Fock
    • Constructor Summary

      Constructors 
      Constructor Description
      SubRequestIteratorSupport​(java.util.Iterator<?> subRequests)
      Creates a SubRequestIterator that decorates an Iterator.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean hasNext()
      Returns true if there are more sub-requests to process.
      protected S mapToSubRequest​(java.lang.Object element)
      Returns the SubRequest contained or represented by the supplied object (element of the iterator).
      S next()
      Gets the next sub-request that is pending.
      void remove()  
      • Methods inherited from interface java.util.Iterator

        forEachRemaining
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • SubRequestIteratorSupport

        public SubRequestIteratorSupport​(java.util.Iterator<?> subRequests)
        Creates a SubRequestIterator that decorates an Iterator.
        Parameters:
        subRequests - an Iterator on SubRequest instances or instances of other objects if mapToSubRequest(Object element) is implemented (overwritten) accordingly.
    • Method Detail

      • hasNext

        public boolean hasNext()
        Description copied from interface: SubRequestIterator
        Returns true if there are more sub-requests to process. In other words, returns true if next would return an element rather than throwing an exception.
        Specified by:
        hasNext in interface java.util.Iterator<S extends SubRequest<?>>
        Specified by:
        hasNext in interface SubRequestIterator<S extends SubRequest<?>>
        Returns:
        true if there are more sub-requests.
      • next

        public S next()
        Description copied from interface: SubRequestIterator
        Gets the next sub-request that is pending.
        Specified by:
        next in interface java.util.Iterator<S extends SubRequest<?>>
        Specified by:
        next in interface SubRequestIterator<S extends SubRequest<?>>
        Returns:
        an unprocessed SubRequest instance.
      • remove

        public void remove()
        Specified by:
        remove in interface java.util.Iterator<S extends SubRequest<?>>
      • mapToSubRequest

        protected S mapToSubRequest​(java.lang.Object element)
        Returns the SubRequest contained or represented by the supplied object (element of the iterator). The default implementation simply casts the supplied object to SubRequest.
        Parameters:
        element - an Object from which a SubRequest can be deduced.
        Returns:
        a SubRequest instance.