Package com.emc.documentum.rest.paging

# Class Page<T>

java.lang.Object
com.emc.documentum.rest.paging.Page<T>

Type Parameters:
  `T` - the object class in the page

public class Page<T> extends Object
A page class provides all the information for the paginated items.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `Page(List<T> itemList, Integer total, int page, int itemsPerPage)`
  Constructor to build a page of items if your items are already paginated, DO NOT use the Paginator class and use this constructor directly
  `Page(List<T> itemList, Integer total, int page, int itemsPerPage, boolean hasMore)`
  Constructor to build a page of items if your items are already paginated, DO NOT use the Paginator class and use this constructor directly

- ## Method Summary

  Modifier and Type
  Method
  Description
  `Map<String,Integer>`
  `getTotalForEach()`
  `boolean`
  `hasItem()`
  Check whether this page is empty or not.
  `boolean`
  `hasNextPage()`
  If the page is the last page or the page does not contain the items requested in this page (which means there is no remaining items available), the page has next page
  `boolean`
  `hasPreviousPage()`
  Check whether this page has a previous one.
  `boolean`
  `isFirstPage()`
  Check whether this page is the first one.
  `boolean`
  `isLastPage()`
  Determine if current page is the last page
  `boolean`
  `isOnePageOnly()`
  Check whether this page contains the complete item collection.
  `boolean`
  `isTotalKnown()`
  Check whether the total count is known by this page.
  `List<T>`
  `items()`
  Return the items in the page.
  `int`
  `itemsPerPage()`
  Return the item size per page; it may be different with the actual item count in this page.
  `int`
  `page()`
  Return the page count
  `void`
  `setTotalForEach(Map<String,Integer> totalForEach)`
  `Integer`
  `total()`
  Return the total account of the queried objects on the server side (not for this page); it's specified in the constructor.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### Page

    public Page(List<T> itemList, Integer total, int page, int itemsPerPage)
    Constructor to build a page of items if your items are already paginated, DO NOT use the Paginator class and use this constructor directly
    Parameters:
      `itemList` - all the items in current page
      `total` - Set total to null if it is unknown
      `page` - the page number for current page
      `itemsPerPage` - the number of items current page

  - ### Page

    public Page(List<T> itemList, Integer total, int page, int itemsPerPage, boolean hasMore)
    Constructor to build a page of items if your items are already paginated, DO NOT use the Paginator class and use this constructor directly
    Parameters:
      `itemList` - the items
      `total` - Set total to null if it is unknown
      `page` - the page number for current page
      `itemsPerPage` - the number of items current page
      `hasMore` - whether there are more items

- ## Method Details

  - ### setTotalForEach

    public void setTotalForEach(Map<String,Integer> totalForEach)

  - ### getTotalForEach

    public Map<String,Integer> getTotalForEach()

  - ### items

    public List<T> items()
    Return the items in the page.
    Returns:
      the items in the page

  - ### hasItem

    public boolean hasItem()
    Check whether this page is empty or not.
    Returns:
      `true` if the page has items; `false` otherwise

  - ### total

    public Integer total()
    Return the total account of the queried objects on the server side (not for this page); it's specified in the constructor.
    Returns:
      total number of queried objects

  - ### isOnePageOnly

    public boolean isOnePageOnly()
    Check whether this page contains the complete item collection.
    Returns:
      `true` if the page has contained the complete item colleciton on the server side; `false` otherwise.

  - ### isTotalKnown

    public boolean isTotalKnown()
    Check whether the total count is known by this page. The total count is known only when it is specified in the constructor.
    Returns:
      `true` if the total count is known; `false` otherwise.

  - ### page

    public int page()
    Return the page count
    Returns:
      the page count

  - ### itemsPerPage

    public int itemsPerPage()
    Return the item size per page; it may be different with the actual item count in this page.
    Returns:
      the item size per page

  - ### hasPreviousPage

    public boolean hasPreviousPage()
    Check whether this page has a previous one.
    Returns:
      `true` if it has a previous page; `false` otherwise.

  - ### hasNextPage

    public boolean hasNextPage()
    If the page is the last page or the page does not contain the items requested in this page (which means there is no remaining items available), the page has next page
    Returns:
      `true` if this page contains a next page; `false` otherwise

  - ### isFirstPage

    public boolean isFirstPage()
    Check whether this page is the first one.
    Returns:
      `true` if it is the first page; `false` otherwise.

  - ### isLastPage

    public boolean isLastPage()
    Determine if current page is the last page
    Returns:
      true/false if the current page is last page or not, return false if it is unknown