public class PaginationParameters extends Object
Modifier and Type | Field and Description |
---|---|
static PaginationParameters |
EVERYTHING_IN_ONE_PAGE
The common pagination parameter object used by non-paginating method in search providers.
|
static PaginationParameters |
ONE_RESULT
Return only the first result.
|
Constructor and Description |
---|
PaginationParameters(int perPage,
int page)
Constructor for already-parsed pagination parameters.
|
PaginationParameters(String perPage,
String page)
Given a pair of strings, attempts to parse them into ints representing the pagination parameters.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object o) |
int |
getPage(int resultSize)
Returns the requested page number.
|
int |
getPerPage() |
int |
hashCode() |
String |
toString() |
PaginationParameters |
withPage(String page)
Returns a new PaginationParameters object with the specified page value.
|
PaginationParameters |
withPerPage(String perPage)
Returns a new PaginationParameters object with the specified perPage value.
|
public static final PaginationParameters EVERYTHING_IN_ONE_PAGE
public static final PaginationParameters ONE_RESULT
public PaginationParameters(String perPage, String page) throws BadPaginationException
perPage
- The number of rows on each page of results.page
- The requested page of dataBadPaginationException
- If at least one of 'perPage' or 'page' is not a positive integer.public PaginationParameters(int perPage, int page)
perPage
- The number of rows to be displayed on each page.page
- The page to be displayedpublic int getPerPage()
public int getPage(int resultSize)
resultSize
- The number of rows in the result setpublic PaginationParameters withPage(String page) throws BadPaginationException
page
- The new page to retrieve.BadPaginationException
- If page is not a positive Java int.public PaginationParameters withPerPage(String perPage) throws BadPaginationException
perPage
- The new number of rows per page.BadPaginationException
- If page is not a positive Java int.Copyright © 2016–2018 Yahoo! Inc.. All rights reserved.