Class PaginationHelper


  • public class PaginationHelper
    extends Object
    • 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 subset
        pageSize - the number of tables to retrieve
        catalogName - 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 subset
        pageSize - the number of tables to retrieve
        paginatedTables - sublist of tables that were returned after pagination
        Returns:
        ListTableResponse with subset of tables.