com.h3c.util

## Class Page<D>

- java.lang.Object
- - com.h3c.util.Page<D>

- Type Parameters:
    `D` - type of the data.
  All Implemented Interfaces:
    Serializable

      public class Page<D>
      extends Object
      implements Serializable

  Data page contains the information representing a single page of data. The data values represented on the page, as well as the index into the list of pages represented by this page, the total number of records available, and the total number of pages possible.
  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `Page(List<D> data, PageRequest pageRequest, long totalRecordCount, long totalPageCount)` Creates a data page.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `<T> Page<T>` | `convert(Converter<D,T> converter)` Converts a page to a different data type.
    `static <T> Page<T>` | `emptyPage()` Returns the empty page (immutable).
    `List<D>` | `getData()` Gets the page data.
    `PageRequest` | `getNextPageRequest()` Creates a request for the next page.
    `long` | `getPageCount()` Gets the total number of pages.
    `PageRequest` | `getPageRequest()` Gets the request that generated this page.
    `PageRequest` | `getPreviousPageRequest()` Creates a request for the previous page.
    `long` | `getRecordCount()` Gets the total number of records.
    `boolean` | `hasNext()` Checks whether there is a page after this one.
    `boolean` | `hasPrevious()` Checks whether there is a page previous to this one.
    `boolean` | `isEmpty()` Determines if a page is empty (contains no data)

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

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

- - ### Constructor Detail

    - #### Page

          public Page(List<D> data,
              PageRequest pageRequest,
              long totalRecordCount,
              long totalPageCount)

      Creates a data page.
      Parameters:
        `data` - page's data.
        `pageRequest` - request that generated this page.
        `totalRecordCount` - total number of records.
        `totalPageCount` - total number of pages.

  - ### Method Detail

    - #### emptyPage

          public static final <T> Page<T> emptyPage()

      Returns the empty page (immutable).
      Returns:
        an empty page.

    - #### isEmpty

          public boolean isEmpty()

      Determines if a page is empty (contains no data)
      Returns:
        true if the page contains no data

    - #### getData

          public List<D> getData()

      Gets the page data.
      Returns:
        the page data.

    - #### getPageRequest

          public PageRequest getPageRequest()

      Gets the request that generated this page.
      Returns:
        the request that generated this page.

    - #### getPageCount

          public long getPageCount()

      Gets the total number of pages.
      Returns:
        the total number of pages.

    - #### getRecordCount

          public long getRecordCount()

      Gets the total number of records.
      Returns:
        the total number of records.

    - #### convert

          public <T> Page<T> convert(Converter<D,T> converter)

      Converts a page to a different data type.
      Parameters:
        `converter` - converter.
      Returns:
        a page with the new data type.

    - #### hasNext

          public boolean hasNext()

      Checks whether there is a page after this one.
      Returns:
        `true` if there is a page after this one, `false` otherwise.

    - #### hasPrevious

          public boolean hasPrevious()

      Checks whether there is a page previous to this one.
      Returns:
        `true` if there is a page previous to this one, `false` otherwise.

    - #### getNextPageRequest

          public PageRequest getNextPageRequest()

      Creates a request for the next page.
      Returns:
        a request for the next page if there is a page, `null` otherwise.

    - #### getPreviousPageRequest

          public PageRequest getPreviousPageRequest()

      Creates a request for the previous page.
      Returns:
        a request for the previous page if there is a page, `null` otherwise.

Copyright © 2014. All Rights Reserved.