Class PagedModel.PageMetadata

java.lang.Object
org.springframework.hateoas.PagedModel.PageMetadata
Enclosing class:
PagedModel<T>

public static class PagedModel.PageMetadata extends Object
Value object for pagination metadata.
Author:
Oliver Gierke
  • Constructor Details

    • PageMetadata

      protected PageMetadata()
    • PageMetadata

      public PageMetadata(long size, long number, long totalElements, long totalPages)
      Creates a new PagedModel.PageMetadata from the given size, number, total elements and total pages.
      Parameters:
      size -
      number - zero-indexed, must be less than totalPages
      totalElements -
      totalPages -
    • PageMetadata

      public PageMetadata(long size, long number, long totalElements)
      Creates a new PagedModel.PageMetadata from the given size, number and total elements.
      Parameters:
      size - the size of the page
      number - the number of the page
      totalElements - the total number of elements available
  • Method Details

    • getSize

      public long getSize()
      Returns the requested size of the page.
      Returns:
      the size a positive long.
    • getTotalElements

      public long getTotalElements()
      Returns the total number of elements available.
      Returns:
      the totalElements a positive long.
    • getTotalPages

      public long getTotalPages()
      Returns how many pages are available in total.
      Returns:
      the totalPages a positive long.
    • getNumber

      public long getNumber()
      Returns the number of the current page.
      Returns:
      the number a positive long.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(@Nullable Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object