public final class Cursor implements SerializableA cursor that represents a position in a query.
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:
Cursor originalCursor = preparedQuery.asQueryResultList(withLimit(20)).getCursor(); String encodedCursor = original.toWebSafeString();
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 decodedCursor = Cursor.fromWebSafeString(encodedCursor); List<Entity> nextBatch = preparedQuery.asQueryResultList(withLimit(20).cursor(decoded));
Implements
SerializableStatic Methods
fromWebSafeString(String encodedCursor)
public static Cursor fromWebSafeString(String encodedCursor)Decodes the given encoded cursor
| Parameter | |
|---|---|
| Name | Description | 
encodedCursor | 
        String | 
      
| Returns | |
|---|---|
| Type | Description | 
Cursor | 
        the decoded cursor  | 
      
Methods
equals(@Nullable Object obj)
public boolean equals(@Nullable Object obj)| Parameter | |
|---|---|
| Name | Description | 
obj | 
        Nullable Object | 
      
| Returns | |
|---|---|
| Type | Description | 
boolean | 
        |
hashCode()
public int hashCode()| Returns | |
|---|---|
| Type | Description | 
int | 
        |
reverse() (deprecated)
public 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 com.google.appengine.api.datastore.Query#reverse().
Returns a cursor identical to this.
| Returns | |
|---|---|
| Type | Description | 
Cursor | 
        |
toString()
public String toString()| Returns | |
|---|---|
| Type | Description | 
String | 
        |
toWebSafeString()
public String toWebSafeString()Encodes the current cursor as a web safe string that can later be decoded by #fromWebSafeString(String)
| Returns | |
|---|---|
| Type | Description | 
String | 
        |