Class PagerPaginationSupport<T>
- java.lang.Object
-
- com.atlassian.bamboo.plugins.rest.common.PagerPaginationSupport<T>
-
public class PagerPaginationSupport<T> extends Object
TODO: Copied From Bucket. There eventually will be a copy residing in atlassian-user if JustinK ever finishes his work! we should get rid of this one and use the atlassian-user if it ever happens. This class stores its items using aPager
- which cannot report the total size of the result. ThePager.getCurrentPage()
returns a list of objects currently loaded in memory, which can return aList.size()
. This number is imprecise, however, and is used as functional approximation. For various reasons explained in the {#link Pager} javadoc, the only way to gain an accurate total size from a {#link Pager} is by using its iterator and keeping count of each object.If you have a regular, average sized list of items then use
PaginationSupport
.
-
-
Field Summary
Fields Modifier and Type Field Description static int
DEFAULT_COUNT_ON_EACH_PAGE
int[]
nextStartIndexes
List<T>
page
Integer
pagerSize
int[]
previousStartIndexes
-
Constructor Summary
Constructors Constructor Description PagerPaginationSupport()
PagerPaginationSupport(int countOnEachPage)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getCountOnEachPage()
int
getEndIndex()
com.atlassian.user.search.page.Pager<T>
getItems()
int
getNextIndex()
@org.jetbrains.annotations.Nullable int[]
getNextStartIndexes()
int
getNiceStartIndex()
@Nullable List<T>
getPage()
returns a subset of the list of items passed in, based on startIndex and the max result per pageint
getPreviousIndex()
@org.jetbrains.annotations.Nullable int[]
getPreviousStartIndexes()
int
getStartIndex()
int
getStartIndexValue()
Always return the start index value, regardless of whether the pagination has any total.int
getTotal()
boolean
isTryNext()
void
setItems(com.atlassian.user.search.page.Pager<T> items)
void
setStartIndex(int startIndex)
void
setTryNext(boolean tryNext)
void
skipTo(int indexPosition)
-
-
-
Method Detail
-
getCountOnEachPage
public int getCountOnEachPage()
-
getItems
public com.atlassian.user.search.page.Pager<T> getItems()
-
setItems
public void setItems(com.atlassian.user.search.page.Pager<T> items)
-
setStartIndex
public void setStartIndex(int startIndex)
-
getEndIndex
public int getEndIndex()
-
getStartIndex
public int getStartIndex()
-
getStartIndexValue
public int getStartIndexValue()
Always return the start index value, regardless of whether the pagination has any total.
-
getNextIndex
public int getNextIndex()
-
getPreviousIndex
public int getPreviousIndex()
-
getNextStartIndexes
@Nullable public @org.jetbrains.annotations.Nullable int[] getNextStartIndexes()
-
getPreviousStartIndexes
@Nullable public @org.jetbrains.annotations.Nullable int[] getPreviousStartIndexes()
-
getNiceStartIndex
public int getNiceStartIndex()
-
getPage
@Nullable public @Nullable List<T> getPage()
returns a subset of the list of items passed in, based on startIndex and the max result per page- Returns:
- a page of results
-
getTotal
public int getTotal()
-
skipTo
public void skipTo(int indexPosition)
-
isTryNext
public boolean isTryNext()
-
setTryNext
public void setTryNext(boolean tryNext)
-
-