Class PaginatedResult<T>

  • Type Parameters:
    T - the type of the data held by this class.

    public class PaginatedResult<T>
    extends Object
    The representation of a paginated result that contains useful information for following requests, such as the total number of requested items present in the database.
    Since:
    1.0
    Version:
    $Id$
    • Constructor Detail

      • PaginatedResult

        public PaginatedResult()
        Default constructor that initializes the items with an empty list.
      • PaginatedResult

        public PaginatedResult​(List<T> items,
                               int page,
                               int pageSize,
                               int totalItems)
        Parameters:
        items - the items contained by this paginated result. The size of the items should be smaller than the pageSize.
        page - which page does this object represent.
        pageSize - the number of items present in this paginated result.
        totalItems - the total number of items that can are present in the store where this paginated result is retrieved.
    • Method Detail

      • getItems

        public List<T> getItems()
        Returns:
        the list of items that are present in this paginated result.
      • setItems

        public void setItems​(List<T> items)
        Parameters:
        items - see getItems().
      • getPage

        public int getPage()
        Returns:
        the number of the page.
      • setPage

        public void setPage​(int page)
        Parameters:
        page - see getPage().
      • getPageSize

        public int getPageSize()
        Returns:
        the maximum number of elements the getItems() can contain.
      • setPageSize

        public void setPageSize​(int pageSize)
        Parameters:
        pageSize - see getPageSize().
      • getTotalItems

        public int getTotalItems()
        Returns:
        the total number of items that can be retrieved from the store where this paginated result was retrieved from.
      • setTotalItems

        public void setTotalItems​(int totalItems)
        Parameters:
        totalItems - see getTotalItems().