public final class Cursor
extends java.lang.Object
implements java.io.Serializable
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); ListnextBatch = 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() |
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) |
public Cursor reverse()
Query.reverse()public java.lang.String toWebSafeString()
fromWebSafeString(String)public static Cursor fromWebSafeString(java.lang.String encodedCursor)
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.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Object