public class LimitOffsetPagingQuery<T> extends Object implements PagingList<T>
| Constructor and Description |
|---|
LimitOffsetPagingQuery(EbeanServer server,
SpiQuery<T> query,
int pageSize) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
fetchAheadIfRequired(int pageIndex) |
protected T |
get(int rowIndex) |
List<T> |
getAsList()
Return the data for all the pages in the form of a single List.
|
Future<Integer> |
getFutureRowCount()
Return the Future for getting the total row count.
|
Page<T> |
getPage(int i)
Return the page for a given page position (starting at 0).
|
int |
getPageSize()
Return the page size.
|
EbeanServer |
getServer() |
SpiQuery<T> |
getSpiQuery() |
int |
getTotalPageCount()
Return the total page count.
|
int |
getTotalRowCount()
Return the total row count.
|
protected boolean |
hasNext(int position) |
void |
refresh()
Refresh will clear all the pages and row count forcing them to be
re-fetched when next required.
|
PagingList<T> |
setFetchAhead(boolean fetchAhead)
By default fetchAhead is true so use this to turn off fetchAhead.
|
void |
setServer(EbeanServer server) |
public LimitOffsetPagingQuery(EbeanServer server, SpiQuery<T> query, int pageSize)
public EbeanServer getServer()
public void setServer(EbeanServer server)
public PagingList<T> setFetchAhead(boolean fetchAhead)
PagingListSet this to false if you don't want to fetch ahead using background fetching.
If set to true (or left as to default) then the next page is fetched in the background as soon as the list is accessed.
setFetchAhead in interface PagingList<T>public List<T> getAsList()
PagingListIterating through this list will automatically fire the paging queries as required.
getAsList in interface PagingList<T>public Future<Integer> getFutureRowCount()
PagingListgetFutureRowCount in interface PagingList<T>protected void fetchAheadIfRequired(int pageIndex)
public void refresh()
PagingListrefresh in interface PagingList<T>public Page<T> getPage(int i)
PagingListgetPage in interface PagingList<T>protected boolean hasNext(int position)
protected T get(int rowIndex)
public int getTotalPageCount()
PagingListThis is based on the total row count. This will wait until the row count has returned if it has not already.
getTotalPageCount in interface PagingList<T>public int getPageSize()
PagingListgetPageSize in interface PagingList<T>public int getTotalRowCount()
PagingListThis gets the result from getFutureRowCount and will wait until that query has completed.
getTotalRowCount in interface PagingList<T>Copyright © 2014. All Rights Reserved.