java.lang.Object
com.e1c.langtool.history.db.pagination.Page<T>
All Implemented Interfaces:
IPage<T>, Iterable<T>

public final class Page<T> extends Object implements IPage<T>
Basic implementation of a page.
See Also:
  • Constructor Details

    • Page

      public Page(List<T> content, IPageable pageable, long total)
      Creates a new page with content is slice in range from 0 to the given pageable size.
      Parameters:
      content - the data is stored in this page
      pageable - the pageable object with which this page is associated
      total - the total amount of elements
      Throws:
      IllegalArgumentException - if (pageable size < 0) or (total amount < 0) or (pageable size > total) or content size is less then pageable size
  • Method Details

    • iterator

      public Iterator<T> iterator()
      Specified by:
      iterator in interface Iterable<T>
    • getSize

      public int getSize()
      Description copied from interface: IPage
      Returns the size of this page.
      Specified by:
      getSize in interface IPage<T>
      Returns:
      the size of this page
    • getNumber

      public int getNumber()
      Description copied from interface: IPage
      Returns the number of current page.
      Specified by:
      getNumber in interface IPage<T>
      Returns:
      the number of current page
    • getContentSize

      public int getContentSize()
      Description copied from interface: IPage
      Returns the number of elements this page contains.
      Specified by:
      getContentSize in interface IPage<T>
      Returns:
      he number of elements this page contains
    • getTotalSize

      public long getTotalSize()
      Description copied from interface: IPage
      Returns the total amount of elements.
      Specified by:
      getTotalSize in interface IPage<T>
      Returns:
      the total amount of elements
    • getContent

      public List<T> getContent()
      Description copied from interface: IPage
      Returns the page content.
      Specified by:
      getContent in interface IPage<T>
      Returns:
      the page content
    • getPageable

      public IPageable getPageable()
      Description copied from interface: IPage
      Returns the pageable object are associated with this page.
      Specified by:
      getPageable in interface IPage<T>
      Returns:
      associated pageable object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object