Class PageIterator<TEntity extends com.microsoft.kiota.serialization.Parsable,TCollectionPage extends com.microsoft.kiota.serialization.Parsable & com.microsoft.kiota.serialization.AdditionalDataHolder>

java.lang.Object
com.microsoft.graph.core.tasks.PageIterator<TEntity,TCollectionPage>
Type Parameters:
TEntity - The type of the entity returned in the collection. This type must implement Parsable
TCollectionPage - The Microsoft Graph collection response type returned in the collection response. This type must implement Parsable and AdditionalDataHolder

public class PageIterator<TEntity extends com.microsoft.kiota.serialization.Parsable,TCollectionPage extends com.microsoft.kiota.serialization.Parsable & com.microsoft.kiota.serialization.AdditionalDataHolder> extends Object
A class for iterating through pages of a collection Use to automatically page through result sets across multiple calls and process each item in the result set.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
    PageIterator.Builder<TEntity extends com.microsoft.kiota.serialization.Parsable,TCollectionPage extends com.microsoft.kiota.serialization.Parsable & com.microsoft.kiota.serialization.AdditionalDataHolder>
    A builder class for building a PageIterator.
    static enum 
    Enum to represent the possible states of the PageIterator.
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    Creates a new instance of the PageIterator class
  • Method Summary

    Modifier and Type
    Method
    Description
    protected static <TEntity extends com.microsoft.kiota.serialization.Parsable, TCollectionPage extends com.microsoft.kiota.serialization.Parsable & com.microsoft.kiota.serialization.AdditionalDataHolder>
    List<TEntity>
    extractEntityListFromParsable(TCollectionPage parsableCollection)
    Extracts the list of entities from the Parsable collection page.
    The deltaLink returned from a delta query.
    The nextLink returned from a collection query.
    The state of the page iterator
    void
    Iterates over the collection of entities in the collation page.
    void
    Resumes the iteration over the collection of entities in the collation page.
    protected void
    setCollectionPageFactory(com.microsoft.kiota.serialization.ParsableFactory<TCollectionPage> collectionPageFactory)
    The factory to use for creating the collection page instance.
    protected void
    The current page of the collection.
    protected void
    setPageItemQueue(Queue<TEntity> pageItemQueue)
    The queue of items in the current page.
    protected void
    The processPageItemCallback to use for processing each item in the collection.
    protected void
    setRequestAdapter(com.microsoft.kiota.RequestAdapter requestAdapter)
    Sets the request adapter to use for requests in the page iterator.
    protected void
    setRequestConfigurator(UnaryOperator<com.microsoft.kiota.RequestInformation> requestConfigurator)
    The request configurator to use for requests in the page iterator.

    Methods inherited from class java.lang.Object

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

    • PageIterator

      protected PageIterator()
      Creates a new instance of the PageIterator class
  • Method Details

    • getDeltaLink

      @Nullable public String getDeltaLink()
      The deltaLink returned from a delta query.
      Returns:
      the deltaLink from the delta query
    • getNextLink

      @Nullable public String getNextLink()
      The nextLink returned from a collection query.
      Returns:
      the nextLink from the collection query
    • getPageIteratorState

      @Nonnull public PageIterator.PageIteratorState getPageIteratorState()
      The state of the page iterator
      Returns:
      the state of the page iterator
    • setRequestAdapter

      protected void setRequestAdapter(@Nonnull com.microsoft.kiota.RequestAdapter requestAdapter)
      Sets the request adapter to use for requests in the page iterator.
      Parameters:
      requestAdapter - the request adapter to use for requests.
    • setCollectionPageFactory

      protected void setCollectionPageFactory(@Nonnull com.microsoft.kiota.serialization.ParsableFactory<TCollectionPage> collectionPageFactory)
      The factory to use for creating the collection page instance.
      Parameters:
      collectionPageFactory - the factory to use for creating the collection page.
    • setRequestConfigurator

      protected void setRequestConfigurator(@Nullable UnaryOperator<com.microsoft.kiota.RequestInformation> requestConfigurator)
      The request configurator to use for requests in the page iterator.
      Parameters:
      requestConfigurator - the request configurator to use when modifying requests.
    • setCurrentPage

      protected void setCurrentPage(@Nonnull TCollectionPage currentPage)
      The current page of the collection.
      Parameters:
      currentPage - the current page of the collection.
    • setProcessPageItemCallback

      protected void setProcessPageItemCallback(@Nonnull Function<TEntity,Boolean> processPageItemCallback)
      The processPageItemCallback to use for processing each item in the collection.
      Parameters:
      processPageItemCallback - the processPageItemCallback to use for processing each item in the collection.
    • setPageItemQueue

      protected void setPageItemQueue(@Nonnull Queue<TEntity> pageItemQueue)
      The queue of items in the current page.
      Parameters:
      pageItemQueue - the queue of items in the current page.
    • iterate

      public void iterate() throws com.microsoft.kiota.ApiException, ReflectiveOperationException
      Iterates over the collection of entities in the collation page. Will continues to iterate over the collection of entities in the next page, if there is a next page.
      Throws:
      com.microsoft.kiota.ApiException - if the request was unable to complete for any reason.
      ReflectiveOperationException - if the entity or collection page could not be instantiated or if they are of invalid types.
    • resume

      public void resume() throws com.microsoft.kiota.ApiException, ReflectiveOperationException
      Resumes the iteration over the collection of entities in the collation page.
      Throws:
      com.microsoft.kiota.ApiException - if the request was unable to complete for any reason.
      ReflectiveOperationException - if the entity or collection page could not be instantiated or if they are of invalid types.
    • extractEntityListFromParsable

      @Nonnull protected static <TEntity extends com.microsoft.kiota.serialization.Parsable, TCollectionPage extends com.microsoft.kiota.serialization.Parsable & com.microsoft.kiota.serialization.AdditionalDataHolder> List<TEntity> extractEntityListFromParsable(@Nonnull TCollectionPage parsableCollection) throws IllegalAccessException, InvocationTargetException
      Extracts the list of entities from the Parsable collection page.
      Type Parameters:
      TEntity - the type of the entity.
      TCollectionPage - the type of the collection page.
      Parameters:
      parsableCollection - the Parsable collection page.
      Returns:
      the list of entities.
      Throws:
      IllegalAccessException - if the Parsable does not contain a collection property.
      InvocationTargetException - if the Parsable does not contain a collection property.