public final class Cursor
extends java.lang.Object
implements java.io.Serializable
To resume a Query
at the position defined by a Cursor
, the Cursor
must
be present in the FetchOptions
passed to a PreparedQuery
identical to the one it
was created from.
Cursors can be retrieved from PreparedQuery.asQueryResult*
functions. A typical use
case would be:
The encoded cursor can then be passed safely in a get or post arg of a web request and on another request the next batch of results can be retrieved with:Cursor originalCursor = preparedQuery.asQueryResultList(withLimit(20)).getCursor(); String encodedCursor = original.toWebSafeString();
Cursor decodedCursor = Cursor.fromWebSafeString(encodedCursor); List<Entity> nextBatch = preparedQuery.asQueryResultList(withLimit(20).cursor(decoded));
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object obj) |
static Cursor |
fromWebSafeString(java.lang.String encodedCursor)
Decodes the given encoded cursor
|
int |
hashCode() |
Cursor |
reverse()
Deprecated.
It is no longer necessary to call
reverse() on cursors.
A cursor returned by a query may also be used in the query returned by |
java.lang.String |
toString() |
java.lang.String |
toWebSafeString()
Encodes the current cursor as a web safe string that can later be decoded by
fromWebSafeString(String) |
@Deprecated public Cursor reverse()
reverse()
on cursors.
A cursor returned by a query may also be used in the query returned by Query.reverse()
.
this
.public java.lang.String toWebSafeString()
fromWebSafeString(String)
public static Cursor fromWebSafeString(java.lang.String encodedCursor)
java.lang.IllegalArgumentException
- if the provided string is not a valid encoded cursorpublic boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object