java.lang.Object
org.kohsuke.github.PagedIterable<T>
- Type Parameters:
T- the type of items on each page
- All Implemented Interfaces:
Iterable<T>
- Direct Known Subclasses:
PagedSearchIterable
Iterable that returns PagedIterator. PagedIterable is thread-safe but PagedIterator
is not. Any one instance of PagedIterator should only be called from a single thread.- Author:
- Kohsuke Kawaguchi
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract PagedIterator<T>_iterator(int pageSize) Iterator over page items.final PagedIterator<T>iterator()Returns an iterator over elements of typeT.T[]toArray()Eagerly walkIterableand return the result in an array.protected T[]toArray(PagedIterator<T> iterator) Eagerly walkPagedIteratorand return the result in an array.toList()Eagerly walkIterableand return the result in a list.toSet()Eagerly walkIterableand return the result in a set.withPageSize(int size) Sets the pagination size.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
PagedIterable
public PagedIterable()Instantiate a PagedIterable.
-
-
Method Details
-
_iterator
Iterator over page items.- Parameters:
pageSize- the page size- Returns:
- the paged iterator
-
iterator
Returns an iterator over elements of typeT. -
toArray
Eagerly walkIterableand return the result in an array.- Returns:
- the list
- Throws:
IOException- if an I/O exception occurs.
-
toList
Eagerly walkIterableand return the result in a list.- Returns:
- the list
- Throws:
IOException- if an I/O Exception occurs
-
toSet
Eagerly walkIterableand return the result in a set.- Returns:
- the set
- Throws:
IOException- if an I/O Exception occurs
-
withPageSize
Sets the pagination size.When set to non-zero, each API call will retrieve this many entries.
- Parameters:
size- the size- Returns:
- the paged iterable
-
toArray
Eagerly walkPagedIteratorand return the result in an array.- Parameters:
iterator- thePagedIteratorto read- Returns:
- an array of all elements from the
PagedIterator - Throws:
IOException- if an I/O exception occurs.
-