Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.google.appengine.api.datastore
Class Cursor

    java.lang.Object
      com.google.appengine.api.datastore.Cursor

All Implemented Interfaces:
  java.io.Serializable

    public final class Cursor

extends java.lang.Object
implements java.io.Serializable

A 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 nextBatch = preparedQuery.asQueryResultList(withLimit(20).cursor(decoded));

See Also:
  Serialized Form

Method Summary
`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)`

Methods inherited from class java.lang.Object
`getClass, notify, notifyAll, wait, wait, wait`

Method Detail

### reverse

    public Cursor reverse()

  Returns:
    a new cursor to the location in a query sorted in the reverse direction
  See Also:
    `Query.reverse()`

### toWebSafeString

    public java.lang.String toWebSafeString()

  Encodes the current cursor as a web safe string that can later be decoded by `fromWebSafeString(String)`

### fromWebSafeString

    public static Cursor fromWebSafeString(java.lang.String encodedCursor)

  Decodes the given encoded cursor

  Parameters:
    `encodedCursor` -
  Returns:
    the decoded cursor
  Throws:
    `java.lang.IllegalArgumentException` - if the provided string is not a valid encoded cursor

### equals

    public boolean equals(java.lang.Object obj)

  Overrides:
    `equals` in class `java.lang.Object`

### hashCode

    public int hashCode()

  Overrides:
    `hashCode` in class `java.lang.Object`

### toString

    public java.lang.String toString()

  Overrides:
    `toString` in class `java.lang.Object`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD