public class QueryRange extends Object
| Constructor and Description |
|---|
QueryRange() |
QueryRange(long offset,
int limit) |
| Modifier and Type | Method and Description |
|---|---|
String |
asContentRange(long maxItems)
Creates a string in the form "items 0-24/66" using the values from this
QueryRange along with the maximum number of items available.
|
boolean |
extendsBeyond(int size,
long count) |
long |
getEnd()
Returns an 'end' value calculated from the offset and limit values
set on this QueryRange.
|
int |
getLimit()
Returns the limit value or zero if no limit is set.
|
long |
getOffset() |
long |
getStart()
getStart() is a synonym for getOffset().
|
boolean |
hasLimit()
Answers whether a limit is set on this QueryRange.
|
boolean |
hasOffset() |
boolean |
isInitialized()
Returns true if setLimit(int) and setOffset(long) were both called successfully,
or the constructor QueryRange(long, int) was successfully called.
|
boolean |
isInside(int size,
long count) |
boolean |
isOutside(int size,
long count) |
boolean |
isValid()
Validates the range.
|
void |
setLimit(int value)
Set the query limit, which represents the maximum number of results returned
in a query.
|
void |
setLimitViaEnd(long value)
Sets the limit of this range by calculating the difference between
the already-set offset and the given 'end' value.
|
void |
setOffset(long value) |
void |
setStart(long value)
setStart() is a synonym for setOffset().
|
boolean |
spans(int size,
long count) |
String |
toString() |
public QueryRange()
public QueryRange(long offset,
int limit)
public long getEnd()
public int getLimit()
public boolean hasLimit()
public void setLimit(int value)
value - an integer >= zeroIllegalArgumentException - if the limit is less-than zeropublic void setLimitViaEnd(long value)
value - IllegalArgumentException - if no offset is set or if end is less-than offset, which would cause a negative limit.public long getStart()
public void setStart(long value)
value - public long getOffset()
public boolean hasOffset()
public void setOffset(long value)
public boolean isInitialized()
public boolean isValid()
public String asContentRange(long maxItems)
maxItems - the maximum number of items available.public boolean isOutside(int size,
long count)
public boolean extendsBeyond(int size,
long count)
public boolean spans(int size,
long count)
public boolean isInside(int size,
long count)
Copyright © 2013. All Rights Reserved.