T
- the type of objects to retrieve@API(status=INTERNAL) public class OffsetBasedPaginatedService<T> extends PaginatedService
OffsetBasedPaginatedApi
.
Goal is to fetch elements lazily.chunkSize, DEFAULT_PAGINATION_CHUNK_SIZE, DEFAULT_PAGINATION_TOTAL_SIZE, maxSize
Constructor and Description |
---|
OffsetBasedPaginatedService(OffsetBasedPaginatedApi<T> paginatedApi,
java.lang.Integer chunkSize,
java.lang.Integer maxSize)
The only constructor
|
Modifier and Type | Method and Description |
---|---|
java.util.stream.Stream<T> |
stream()
Returns an stream of elements with lazy fetching.
|
public OffsetBasedPaginatedService(OffsetBasedPaginatedApi<T> paginatedApi, java.lang.Integer chunkSize, java.lang.Integer maxSize)
paginatedApi
- the paginated api used to retrieve the chunks of elementschunkSize
- the maximum number to retrieve in one call of OffsetBasedPaginatedApi.get(int, int)
maxSize
- the maximum number to retrieve in totalpublic java.util.stream.Stream<T> stream()
Stream
which lazily makes calls to the paginatedApi
.