Class Cursor
- java.lang.Object
-
- com.google.appengine.api.datastore.Cursor
-
- All Implemented Interfaces:
Serializable
public final class Cursor extends Object implements Serializable
A cursor that represents a position in a query.To resume a
DatastoreV3Pb.Query
at the position defined by aCursor
, theCursor
must be present in theFetchOptions
passed to aPreparedQuery
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();
Cursor decodedCursor = Cursor.fromWebSafeString(encodedCursor); List<Entity> nextBatch = preparedQuery.asQueryResultList(withLimit(20).cursor(decoded));
- See Also:
- Serialized Form
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description boolean
equals(@Nullable Object obj)
static Cursor
fromWebSafeString(String encodedCursor)
Decodes the given encoded cursorint
hashCode()
Cursor
reverse()
Deprecated.It is no longer necessary to callreverse()
on cursors.String
toString()
String
toWebSafeString()
Encodes the current cursor as a web safe string that can later be decoded byfromWebSafeString(String)
-
-
-
Method Detail
-
reverse
@Deprecated public Cursor reverse()
Deprecated.It is no longer necessary to callreverse()
on cursors.A cursor returned by a query may also be used in the query returned by
Query.reverse()
.Returns a cursor identical tothis
.
-
toWebSafeString
public String toWebSafeString()
Encodes the current cursor as a web safe string that can later be decoded byfromWebSafeString(String)
-
fromWebSafeString
public static Cursor fromWebSafeString(String encodedCursor)
Decodes the given encoded cursor- Returns:
- the decoded cursor
- Throws:
IllegalArgumentException
- if the provided string is not a valid encoded cursor
-
-