Package com.atlassian.bitbucket.util
Interface Page<T>
- Type Parameters:
T
- the type the entity
- All Known Subinterfaces:
PullRequestActivityPage<T>
- All Known Implementing Classes:
FilteredPageImpl
,PageImpl
,SimplePullRequestActivityPage
public interface Page<T>
Provides support for pagination.
Pagination makes no guarantee that the next page will have a starting offset of getStart()
+
getLimit()
. Callers must use getNextPageRequest()
to navigate to the next page.
-
Method Summary
Modifier and TypeMethodDescriptiondefault void
Performs an action on each result in the page.boolean
int
getLimit()
Get a map of the page values mapped by their ordinal values.int
getSize()
int
getStart()
stream()
<E> Page<E>
Transforms the results on the page, producing a newPage
with differentvalues
but all other properties (e.g.
-
Method Details
-
forEach
Performs an action on each result in the page.- Parameters:
action
- the action to apply to each result- Since:
- 6.3
-
getIsLastPage
boolean getIsLastPage()- Returns:
true
if there are no more results; otherwise,false
if at least one more page, perhaps partially filled but not empty, of results is available
-
getLimit
int getLimit()- Returns:
- the original limit on the
PageRequest
that generated this page
-
getNextPageRequest
- Returns:
- a request which can be used to retrieve the next page, which will be
null
if this was thelast page
-
getOrdinalIndexedValues
Get a map of the page values mapped by their ordinal values. For filtered pages, the ordinals are the ordinals in the underlying paged collection.- Returns:
- values mapped by their ordinal value in the page
-
getSize
int getSize()- Returns:
- the number of results in the page
-
getStart
int getStart()- Returns:
- the offset into the overall result set the page starts at (0 based)
-
getValues
- Returns:
- the page's results
-
stream
- Returns:
- a
Stream
over the page's results
-
transform
Transforms the results on the page, producing a newPage
with differentvalues
but all other properties (e.g.start
andlimit
) unchanged.Implementation note: Transformation is done eagerly to ensure the resulting
Page
does not retain a reference to the original results from the source page. If a transform is used purely to apply some set of side effects, consider usingforEach(java.util.function.Consumer<? super T>)
instead.- Type Parameters:
E
- the target type- Parameters:
transformFunction
- the transformer- Returns:
- a new page with transformed results
-