Class PaginationHelper
- java.lang.Object
-
- com.amazonaws.athena.connector.util.PaginationHelper
-
public class PaginationHelper extends Object
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static String
calculateNextToken(int token, int pageSize, List<TableName> paginatedTables)
Calculates the nextToken or index to begin next pagination based on number of tables returns and pageSize.static ListTablesResponse
manualPagination(List<TableName> allTables, String token, int pageSize, String catalogName)
Performs a manual or "fake" pagination.static int
validateAndParsePaginationArguments(String nextToken, int pageSize)
Validates that nextToken and pageSize are valid non-negative integers, with the exception of pageSize allowed to be -1 signifying unlimited pages.
-
-
-
Method Detail
-
validateAndParsePaginationArguments
public static int validateAndParsePaginationArguments(String nextToken, int pageSize)
Validates that nextToken and pageSize are valid non-negative integers, with the exception of pageSize allowed to be -1 signifying unlimited pages.- Parameters:
nextToken
-pageSize
-- Returns:
- int nextToken
-
manualPagination
public static ListTablesResponse manualPagination(List<TableName> allTables, String token, int pageSize, String catalogName)
Performs a manual or "fake" pagination. Takes a list of allTables retrieved and returns a subset of tables based off of startToken and pageSize.- Parameters:
token
- the start position in the subsetpageSize
- the number of tables to retrievecatalogName
- required to return in ListTableResponse- Returns:
- ListTableResponse with subset of tables.
-
calculateNextToken
public static String calculateNextToken(int token, int pageSize, List<TableName> paginatedTables)
Calculates the nextToken or index to begin next pagination based on number of tables returns and pageSize.- Parameters:
token
- the start position in the subsetpageSize
- the number of tables to retrievepaginatedTables
- sublist of tables that were returned after pagination- Returns:
- ListTableResponse with subset of tables.
-
-