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
-
Constructor Summary
ConstructorDescriptionOffsetPageRequest
(int limit, long offset) OffsetPageRequest
(int limit, long offset, org.springframework.data.domain.Sort sort) -
Method Summary
Modifier and TypeMethodDescriptionprivate void
check
(int limit) defaultSort
(org.springframework.data.domain.Sort.Direction direction, String... properties) boolean
protected String
filterProperty
(String property) first()
protected int
long
int
int
protected String
org.springframework.data.domain.Sort
getSort()
int
hashCode()
boolean
next()
static OffsetPageRequest
of()
static OffsetPageRequest
of
(int limit, long offset) static OffsetPageRequest
of
(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.Sort
previous()
void
setLimit
(int limit) Sets limit.void
setOffset
(long offset) Sets offset.void
Sets sorts.toString()
withPage
(int pageNumber) Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods 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:
getPageNumber
in interfaceorg.springframework.data.domain.Pageable
-
getPageSize
public int getPageSize()- Specified by:
getPageSize
in interfaceorg.springframework.data.domain.Pageable
-
getOffset
public long getOffset()- Specified by:
getOffset
in interfaceorg.springframework.data.domain.Pageable
-
getSort
public org.springframework.data.domain.Sort getSort()- Specified by:
getSort
in interfaceorg.springframework.data.domain.Pageable
-
next
- Specified by:
next
in interfaceorg.springframework.data.domain.Pageable
-
previous
-
previousOrFirst
- Specified by:
previousOrFirst
in interfaceorg.springframework.data.domain.Pageable
-
first
- Specified by:
first
in interfaceorg.springframework.data.domain.Pageable
-
withPage
- Specified by:
withPage
in interfaceorg.springframework.data.domain.Pageable
-
hasPrevious
public boolean hasPrevious()- Specified by:
hasPrevious
in 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
-