Package org.oxerr.commons.ws.rs.data
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 Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionOffsetPageRequest(int limit, long offset) OffsetPageRequest(int limit, long offset, org.springframework.data.domain.Sort sort) -
Method Summary
Modifier and TypeMethodDescriptionprivate voidcheck(int limit) defaultSort(org.springframework.data.domain.Sort.Direction direction, String... properties) booleanprotected StringfilterProperty(String property) first()protected intlongintintprotected Stringorg.springframework.data.domain.SortgetSort()inthashCode()booleannext()static OffsetPageRequestof()static OffsetPageRequestof(int limit, long offset) static OffsetPageRequestof(int limit, long offset, org.springframework.data.domain.Sort sort) protected Optional<org.springframework.data.domain.Sort.Direction>parseDirection(String value) protected List<org.springframework.data.domain.Sort.Order>parseOrders(List<String> source) protected org.springframework.data.domain.Sortprevious()voidsetLimit(int limit) Sets limit.voidsetOffset(long offset) Sets offset.voidSets sorts.toString()withPage(int pageNumber) Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.springframework.data.domain.Pageable
getSortOr, isPaged, isUnpaged, toOptional
-
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
- See Also:
-
DEFAULT_PROPERTY_DELIMITER
- See Also:
-
maxLimit
private int maxLimit -
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
-
of
-
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
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:
getPageNumberin interfaceorg.springframework.data.domain.Pageable
-
getPageSize
public int getPageSize()- Specified by:
getPageSizein interfaceorg.springframework.data.domain.Pageable
-
getOffset
public long getOffset()- Specified by:
getOffsetin interfaceorg.springframework.data.domain.Pageable
-
getSort
public org.springframework.data.domain.Sort getSort()- Specified by:
getSortin interfaceorg.springframework.data.domain.Pageable
-
next
- Specified by:
nextin interfaceorg.springframework.data.domain.Pageable
-
previous
-
previousOrFirst
- Specified by:
previousOrFirstin interfaceorg.springframework.data.domain.Pageable
-
first
- Specified by:
firstin interfaceorg.springframework.data.domain.Pageable
-
withPage
- Specified by:
withPagein interfaceorg.springframework.data.domain.Pageable
-
hasPrevious
public boolean hasPrevious()- Specified by:
hasPreviousin interfaceorg.springframework.data.domain.Pageable
-
getMaxLimit
protected int getMaxLimit() -
getPropertyDelimiter
-
filterProperty
-
parseDirection
-
parseOrders
-
parseSort
-
check
private void check(int limit) -
hashCode
public int hashCode() -
equals
-
toString
-