Class PageImpl<Entity>

java.lang.Object
com.labs64.netlicensing.domain.vo.PageImpl<Entity>
Type Parameters:
Entity - the type of which the page consists.
All Implemented Interfaces:
Page<Entity>, Serializable, Iterable<Entity>

public class PageImpl<Entity> extends Object implements Page<Entity>, Serializable
Basic Page implementation.
See Also:
  • Constructor Details

    • PageImpl

      public PageImpl(List<Entity> content, int pageNumber, int itemsNumber, int totalPages, long totalItems, boolean hasNext)
      Constructor of PageImpl.
      Parameters:
      content - the content of this page, must not be null.
      pageNumber - the number of the current page
      itemsNumber - the number of elements on the page
      totalPages - the number of total pages
      totalItems - the total amount of elements
      hasNext - is there a next page exists
  • Method Details

    • createInstance

      public static <E> PageImpl<E> createInstance(List<E> content, String pageNumber, String itemsNumber, String totalPages, String totalItems, String hasNext)
      Safe create instance of Page.
      Type Parameters:
      E - type of page entity
      Parameters:
      content - the content of this page, must not be null.
      pageNumber - the number of the current page
      itemsNumber - the number of elements on the page
      totalPages - the number of total pages
      totalItems - the total amount of elements
      hasNext - is there a next page exists
    • getPageNumber

      public int getPageNumber()
      Description copied from interface: Page
      Returns the number of the current page. Is always non-negative.
      Specified by:
      getPageNumber in interface Page<Entity>
      Returns:
      the number of the current page.
    • getItemsNumber

      public int getItemsNumber()
      Description copied from interface: Page
      Returns the number of elements on the page.
      Specified by:
      getItemsNumber in interface Page<Entity>
      Returns:
      the number of elements on the page.
    • getTotalPages

      public int getTotalPages()
      Description copied from interface: Page
      Returns the number of total pages.
      Specified by:
      getTotalPages in interface Page<Entity>
      Returns:
      the number of total pages
    • getTotalItems

      public long getTotalItems()
      Description copied from interface: Page
      Returns the total amount of elements.
      Specified by:
      getTotalItems in interface Page<Entity>
      Returns:
      the total amount of elements
    • hasNext

      public boolean hasNext()
      Description copied from interface: Page
      Returns if there is a next page exists.
      Specified by:
      hasNext in interface Page<Entity>
      Returns:
      true if there is a next page exists, otherwise false.
    • iterator

      public Iterator<Entity> iterator()
      Specified by:
      iterator in interface Iterable<Entity>
    • getContent

      public List<Entity> getContent()
      Description copied from interface: Page
      Return container content.
      Specified by:
      getContent in interface Page<Entity>
      Returns:
      container content
    • hasContent

      public boolean hasContent()
      Description copied from interface: Page
      Returns if there is a content exists.
      Specified by:
      hasContent in interface Page<Entity>
      Returns:
      true if there is a content exists, otherwise false
    • toString

      public String toString()
      Overrides:
      toString in class Object