T - Type of resource that the page request is for.public abstract class PageRequest<T> extends Object
| Modifier and Type | Field and Description |
|---|---|
static int |
PAGE_SIZE_DEFAULT |
protected int |
pageSize
Maximum number of results to return in a page.
|
protected String |
pageToken
Token to identify the page to retrieve.
|
static String |
SORT_ORDER_ASC |
static String |
SORT_ORDER_DESC |
protected String |
sortBy
Indicates the table column name based on which results should be sorted.
|
protected io.cdap.cdap.spi.data.SortOrder |
sortOrder
Indicates the sorting order (ascending or descending).
|
| Modifier | Constructor and Description |
|---|---|
protected |
PageRequest(Integer pageSize,
String pageToken,
String sortBy,
String sortOrder) |
| Modifier and Type | Method and Description |
|---|---|
protected abstract String |
getDefaultSortBy()
Get the default table column name using which results will be sorted.
|
abstract String |
getNextPageToken(T object)
Get the nextPageToken returned as part of response to request.
|
int |
getPageSize() |
String |
getPageToken() |
abstract io.cdap.cdap.spi.data.table.field.Range |
getScanRange()
Constructs the range used to query the storage table.
|
String |
getSortBy() |
protected abstract String |
getSortByColumnName(String sortBy)
Get the table column name mapped to given sortBy value.
|
io.cdap.cdap.spi.data.SortOrder |
getSortOrder() |
protected void |
validatePageSize(Integer pageSize) |
protected abstract void |
validateSortBy(String sortBy)
Checks whether given sortBy value has a respective table column mapping.
|
protected void |
validateSortOrder(String sortOrder) |
protected final int pageSize
@Nullable protected final String pageToken
protected final String sortBy
protected final io.cdap.cdap.spi.data.SortOrder sortOrder
public static final String SORT_ORDER_ASC
public static final String SORT_ORDER_DESC
public static final int PAGE_SIZE_DEFAULT
public int getPageSize()
public String getSortBy()
public io.cdap.cdap.spi.data.SortOrder getSortOrder()
protected abstract void validateSortBy(String sortBy) throws IllegalArgumentException
sortBy - field based on which results should be sortedIllegalArgumentException - if the value does not have a mappingprotected abstract String getDefaultSortBy()
protected abstract String getSortByColumnName(String sortBy)
public abstract io.cdap.cdap.spi.data.table.field.Range getScanRange()
Range corresponding to page query parameters.public abstract String getNextPageToken(T object)
object - resource returned by the requestprotected void validatePageSize(Integer pageSize)
protected void validateSortOrder(String sortOrder)
Copyright © 2023 CDAP Licensed under the Apache License, Version 2.0.