Class OffsetPageRequest

java.lang.Object
org.oxerr.commons.ws.rs.data.OffsetPageRequest
All Implemented Interfaces:
Serializable, org.springframework.data.domain.Pageable

public class OffsetPageRequest extends Object implements org.springframework.data.domain.Pageable, Serializable
Pageable implementation using limit-offset mode.
See Also:
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      See Also:
    • DEFAULT_MAX_LIMIT

      private static final int DEFAULT_MAX_LIMIT
      See Also:
    • DEFAULT_LIMIT

      private static final int DEFAULT_LIMIT
      See Also:
    • DEFAULT_LIMIT_STRING

      private static final String DEFAULT_LIMIT_STRING
      See Also:
    • DEFAULT_PROPERTY_DELIMITER

      private static final String DEFAULT_PROPERTY_DELIMITER
      See Also:
    • maxLimit

      private int maxLimit
    • propertyDelimiter

      private String propertyDelimiter
    • limit

      private int limit
    • offset

      private long offset
    • sort

      private org.springframework.data.domain.Sort sort
  • Constructor Details

    • OffsetPageRequest

      public OffsetPageRequest()
    • OffsetPageRequest

      public OffsetPageRequest(int limit, long offset)
    • OffsetPageRequest

      public OffsetPageRequest(int limit, long offset, org.springframework.data.domain.Sort sort)
  • Method Details

    • of

      public static OffsetPageRequest of()
    • of

      public static OffsetPageRequest of(int limit, long offset)
    • of

      public static OffsetPageRequest of(int limit, long offset, org.springframework.data.domain.Sort sort)
    • defaultSort

      public OffsetPageRequest defaultSort(org.springframework.data.domain.Sort.Direction direction, String... properties)
    • setLimit

      @QueryParam("limit") @DefaultValue("10") public void setLimit(int limit)
      Sets limit.
      Parameters:
      limit - the size of the page to be returned.
    • setOffset

      @QueryParam("offset") @DefaultValue("0") public void setOffset(long offset)
      Sets offset.
      Parameters:
      offset - number of records to be skipped from the result set.
    • setSort

      @QueryParam("sort[]") public void setSort(List<String> sorts)
      Sets sorts.
      Parameters:
      sorts - the sorting strings. One sorting string is a comma separated string of property and direction, such as property,asc, property,desc.
    • getPageNumber

      public int getPageNumber()
      Specified by:
      getPageNumber in interface org.springframework.data.domain.Pageable
    • getPageSize

      public int getPageSize()
      Specified by:
      getPageSize in interface org.springframework.data.domain.Pageable
    • getOffset

      public long getOffset()
      Specified by:
      getOffset in interface org.springframework.data.domain.Pageable
    • getSort

      public org.springframework.data.domain.Sort getSort()
      Specified by:
      getSort in interface org.springframework.data.domain.Pageable
    • next

      public OffsetPageRequest next()
      Specified by:
      next in interface org.springframework.data.domain.Pageable
    • previous

      public OffsetPageRequest previous()
    • previousOrFirst

      public OffsetPageRequest previousOrFirst()
      Specified by:
      previousOrFirst in interface org.springframework.data.domain.Pageable
    • first

      public OffsetPageRequest first()
      Specified by:
      first in interface org.springframework.data.domain.Pageable
    • withPage

      public OffsetPageRequest withPage(int pageNumber)
      Specified by:
      withPage in interface org.springframework.data.domain.Pageable
    • hasPrevious

      public boolean hasPrevious()
      Specified by:
      hasPrevious in interface org.springframework.data.domain.Pageable
    • getMaxLimit

      protected int getMaxLimit()
    • getPropertyDelimiter

      protected String getPropertyDelimiter()
    • filterProperty

      protected String filterProperty(String property)
    • parseDirection

      protected Optional<org.springframework.data.domain.Sort.Direction> parseDirection(String value)
    • parseOrders

      protected List<org.springframework.data.domain.Sort.Order> parseOrders(List<String> source)
    • parseSort

      protected org.springframework.data.domain.Sort parseSort(List<String> sorts)
    • check

      private void check(int limit)
    • 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