다음을 통해 공유


ContinuablePagedIterable<C,T,P> Class

Type Parameters

C

the type of the continuation token

T

The type of elements in a ContinuablePage

P

The ContinuablePage holding items of type T.

public class ContinuablePagedIterable<C,T,P>
extends IterableStream<T>

This class provides utility to iterate over ContinuablePage<C,T> using Stream Iterable interfaces.

Constructor Summary

Constructor Description
ContinuablePagedIterable(ContinuablePagedFlux<C,T,P> pagedFlux)

Creates instance with the given ContinuablePagedFlux<C,T,P>.

ContinuablePagedIterable(ContinuablePagedFlux<C,T,P> pagedFlux, int batchSize)

Creates instance with the given ContinuablePagedFlux<C,T,P>.

ContinuablePagedIterable(Supplier<PageRetrieverSync<C,P>> pageRetrieverSyncProvider, Integer pageSize, Predicate<C> continuationPredicate)

Creates instance with the given PageRetrieverSync<C,P>.

Method Summary

Modifier and Type Method and Description
Iterable<P> iterableByPage()

Retrieve the Iterable, one page at a time.

Iterable<P> iterableByPage(C continuationToken)

Retrieve the Iterable, one page at a time, starting from the next page associated with the given continuation token.

Iterable<P> iterableByPage(C continuationToken, int preferredPageSize)

Retrieve the Iterable, one page at a time, with each page containing preferredPageSize items, starting from the next page associated with the given continuation token.

Iterable<P> iterableByPage(int preferredPageSize)

Retrieve the Iterable, one page at a time, with each page containing preferredPageSize items.

Iterator<T> iterator()

Utility function to provide Iterator of value T.

Stream<T> stream()

Utility function to provide Stream of value T.

Stream<P> streamByPage()

Retrieve the Stream, one page at a time.

Stream<P> streamByPage(C continuationToken)

Retrieve the Stream, one page at a time, starting from the next page associated with the given continuation token.

Stream<P> streamByPage(C continuationToken, int preferredPageSize)

Retrieve the Stream, one page at a time, with each page containing preferredPageSize items, starting from the next page associated with the given continuation token.

Stream<P> streamByPage(int preferredPageSize)

Retrieve the Stream, one page at a time, with each page containing preferredPageSize items.

Methods inherited from IterableStream

Methods inherited from java.lang.Object

Constructor Details

ContinuablePagedIterable

public ContinuablePagedIterable(ContinuablePagedFlux pagedFlux)

Creates instance with the given ContinuablePagedFlux<C,T,P>.

Parameters:

pagedFlux - the paged flux use as iterable

ContinuablePagedIterable

public ContinuablePagedIterable(ContinuablePagedFlux pagedFlux, int batchSize)

Creates instance with the given ContinuablePagedFlux<C,T,P>.

Parameters:

pagedFlux - the paged flux use as iterable
batchSize - the bounded capacity to prefetch from the ContinuablePagedFlux<C,T,P>

ContinuablePagedIterable

public ContinuablePagedIterable(Supplier> pageRetrieverSyncProvider, Integer pageSize, Predicate continuationPredicate)

Creates instance with the given PageRetrieverSync<C,P>.

Parameters:

pageRetrieverSyncProvider - A provider that returns PageRetrieverSync<C,P>.
pageSize - The preferred page size.
continuationPredicate - A predicate which determines if paging should continue.

Method Details

iterableByPage

public Iterable

iterableByPage()

Retrieve the Iterable, one page at a time. It will provide same Iterable of T values from starting if called multiple times.

Returns:

Stream of a pages

iterableByPage

public Iterable

iterableByPage(C continuationToken)

Retrieve the Iterable, one page at a time, starting from the next page associated with the given continuation token. To start from first page, use iterableByPage() instead.

Parameters:

continuationToken - The continuation token used to fetch the next page

Returns:

Iterable of a pages

iterableByPage

public Iterable

iterableByPage(C continuationToken, int preferredPageSize)

Retrieve the Iterable, one page at a time, with each page containing preferredPageSize items, starting from the next page associated with the given continuation token. To start from first page, use iterableByPage() or iterableByPage(int preferredPageSize) instead.

Parameters:

continuationToken - The continuation token used to fetch the next page
preferredPageSize - the preferred page size, service may or may not honor the page size preference hence client MUST be prepared to handle pages with different page size.

Returns:

Iterable of a pages

iterableByPage

public Iterable

iterableByPage(int preferredPageSize)

Retrieve the Iterable, one page at a time, with each page containing preferredPageSize items.

It will provide same Iterable of T values from starting if called multiple times.

Parameters:

preferredPageSize - the preferred page size, service may or may not honor the page size preference hence client MUST be prepared to handle pages with different page size.

Returns:

Iterable of a pages

iterator

public Iterator iterator()

Utility function to provide Iterator of value T.

Overrides:

ContinuablePagedIterable<C,T,P>.iterator()

stream

public Stream stream()

Utility function to provide Stream of value T.

Overrides:

ContinuablePagedIterable<C,T,P>.stream()

streamByPage

public Stream

streamByPage()

Retrieve the Stream, one page at a time. It will provide same Stream of T values from starting if called multiple times.

Returns:

Stream of a pages

streamByPage

public Stream

streamByPage(C continuationToken)

Retrieve the Stream, one page at a time, starting from the next page associated with the given continuation token. To start from first page, use streamByPage() instead.

Parameters:

continuationToken - The continuation token used to fetch the next page

Returns:

Stream of a pages

streamByPage

public Stream

streamByPage(C continuationToken, int preferredPageSize)

Retrieve the Stream, one page at a time, with each page containing preferredPageSize items, starting from the next page associated with the given continuation token. To start from first page, use streamByPage() or streamByPage(int preferredPageSize) instead.

Parameters:

continuationToken - The continuation token used to fetch the next page
preferredPageSize - the preferred page size, service may or may not honor the page size preference hence client MUST be prepared to handle pages with different page size.

Returns:

Stream of a pages

streamByPage

public Stream

streamByPage(int preferredPageSize)

Retrieve the Stream, one page at a time, with each page containing preferredPageSize items.

It will provide same Stream of T values from starting if called multiple times.

Parameters:

preferredPageSize - the preferred page size, service may or may not honor the page size preference hence client MUST be prepared to handle pages with different page size.

Returns:

Stream of a pages

Applies to