|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.google.appengine.api.datastore.FetchOptions
public final class FetchOptions
Describes the limit, offset, and chunk size to be applied when
executing a PreparedQuery
.
limit
is the maximum number of results the query will return.
offset
is the number of result to skip before returning any
results. Results that are skipped due to offset do not count against
limit
.
chunkSize
determines the internal chunking strategy of the
Iterator
returned by PreparedQuery.asIterator(FetchOptions)
and the Iterable
returned by
PreparedQuery.asIterable(FetchOptions)
. Note that unlike
limit
and offset
, chunkSize
has no
impact on the result of the PreparedQuery
, but rather only the
performance of the PreparedQuery
.
Notes on usage:
The recommended way to instantiate a FetchOptions
object is to
statically import FetchOptions.Builder
.* and invoke a static
creation method followed by an instance mutator (if needed):
import static com.google.appengine.api.datastore.FetchOptions.Builder.*; ... // limit 10 datastoreService.prepare(query).asList(withLimit(10)); // limit 10, offset 5 datastoreService.prepare(query).asList(withLimit(10).offset(5));
Nested Class Summary | |
---|---|
static class |
FetchOptions.Builder
Contains static creation methods for FetchOptions . |
Field Summary | |
---|---|
static int |
DEFAULT_CHUNK_SIZE
Default number of Entity objects to retrieve at a time. |
Method Summary | |
---|---|
FetchOptions |
chunkSize(int chunkSize)
Sets the chunk size. |
FetchOptions |
limit(int limit)
Sets the limit. |
FetchOptions |
offset(int offset)
Sets the offset. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int DEFAULT_CHUNK_SIZE
Entity
objects to retrieve at a time. This
is an optimization that avoids making an RPC call for each Entity
.
Method Detail |
---|
public FetchOptions limit(int limit)
limit
- The limit to set. Must be greater than 0.
this
(for chaining)public FetchOptions offset(int offset)
offset
- The offset to set. Must be 0 or greater.
this
(for chaining)public FetchOptions chunkSize(int chunkSize)
chunkSize
- The chunk size to set. Must be greater than 0.
this
(for chaining)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |