Package com.atlassian.bitbucket.util
Class PageImpl<T>
java.lang.Object
com.atlassian.bitbucket.util.PageImpl<T>
- All Implemented Interfaces:
Page<T>
-
Constructor Summary
ConstructorDescriptionPageImpl
(PageRequest pageRequest, int size, Iterable<T> values, boolean lastPage) PageImpl
(PageRequest pageRequest, Iterable<T> values, boolean lastPage) Creates a page from the providedvalues
and explicitly setsgetIsLastPage()
.PageImpl
(PageRequest pageRequest, Iterable<T> values, boolean lastPage, int size, int nextPageStart) -
Method Summary
Modifier and TypeMethodDescriptionboolean
void
Performs an action on each result in the page.boolean
int
getLimit()
protected int
Get a map of the page values mapped by their ordinal values.int
getSize()
int
getStart()
int
hashCode()
<E> PageImpl<E>
Transforms the results on the page, producing a newPage
with differentvalues
but all other properties (e.g.
-
Constructor Details
-
PageImpl
Creates a page from the providedvalues
and explicitly setsgetIsLastPage()
andsize
. The nextPageRequest
will be inferred from thestart
andlimit
of the providedPageRequest
.- Parameters:
pageRequest
- the page request used to create this pagesize
- the size of the page - i.e. the number of elements in this pagevalues
- an iterable of the valueslastPage
- if this is the last page
-
PageImpl
public PageImpl(PageRequest pageRequest, Iterable<T> values, boolean lastPage, int size, int nextPageStart) Creates a page from the providedvalues
and explicitly setsgetIsLastPage()
andsize
. The nextPageRequest
will start from the specifiednextPageStart
, with the samelimit
as the providedPageRequest
.- Parameters:
pageRequest
- the page request used to create this pagevalues
- an iterable of the valueslastPage
- if this is the last pagesize
- the size of the page - i.e. the number of elements in this pagenextPageStart
- index of the element that will be the first in the next page- Since:
- 4.12
-
PageImpl
Creates a page from the providedvalues
and explicitly setsgetIsLastPage()
.- Parameters:
pageRequest
- the page request used to create this pagevalues
- an iterable of the valueslastPage
- if this is the last page
-
-
Method Details
-
equals
-
forEach
Description copied from interface:Page
Performs an action on each result in the page. -
getIsLastPage
public boolean getIsLastPage()- Specified by:
getIsLastPage
in interfacePage<T>
- 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
public int getLimit()- Specified by:
getLimit
in interfacePage<T>
- Returns:
- the original limit on the
PageRequest
that generated this page
-
getNextPageRequest
- Specified by:
getNextPageRequest
in interfacePage<T>
- Returns:
- a request which can be used to retrieve the next page, which will be
null
if this was thelast page
-
getOrdinalIndexedValues
Description copied from interface:Page
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.- Specified by:
getOrdinalIndexedValues
in interfacePage<T>
- Returns:
- values mapped by their ordinal value in the page
-
getSize
public int getSize() -
getStart
public int getStart() -
getValues
-
hashCode
public int hashCode() -
transform
@Nonnull public <E> PageImpl<E> transform(@Nonnull Function<? super T, ? extends E> transformFunction) Description copied from interface:Page
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 usingPage.forEach(java.util.function.Consumer<? super T>)
instead. -
getNextPageOffset
protected int getNextPageOffset()
-