FetchOptions (Google App Engine API for Java)


Class FetchOptions

  • java.lang.Object
    • com.google.appengine.api.datastore.FetchOptions

  • public final class FetchOptions
    extends java.lang.Object
    Describes the limit, offset, and chunk size to be applied when executing a PreparedQuery.

    limit is the maximum number of results the query will return.

    offset is the number of results to skip before returning any results. Results that are skipped due to offset do not count against limit.
    Note: Using offset still retrieves skipped entities internally. This affects the latency of the query, and your application is billed for the operations required to retrieve them. Using cursors lets you avoid these costs.

    startCursor and endCursor are previously generated cursors that point to locations in a result set. If specified queries will start and end at these locations.

    prefetchSize is the number of results retrieved on the first call to the datastore.

    chunkSize determines the internal chunking strategy of the Iterator returned by PreparedQuery.asIterator(FetchOptions) and the Iterable returned by PreparedQuery.asIterable(FetchOptions).

    Note that unlike limit, offset and cursor, prefetchSize and chunkSize have no impact on the result of the PreparedQuery, but rather only the performance of the PreparedQuery.

    Notes on usage:
    The recommended way to instantiate a FetchOptions object is to import FetchOptions and invoke a static creation method followed by an instance mutator (if needed):

     import com.google.appengine.api.datastore.FetchOptions;
     Cursor cursor = ...
     // limit 10
     // limit 10, start cursor
    • Field Detail


        public static final int DEFAULT_CHUNK_SIZE
        Deprecated. Instead of using DEFAULT_CHUNK_SIZE, do not specify a chunk size.
        See Also:
        Constant Field Values
    • Method Detail

      • limit

        public FetchOptions limit(int limit)
        Sets the limit. Please read the class javadoc for an explanation of how limit is used.
        limit - The limit to set. Must be non-negative.
        this (for chaining)
      • offset

        public FetchOptions offset(int offset)
        Sets the offset. Please read the class javadoc for an explanation of how offset is used.
        offset - The offset to set. Must be 0 or greater.
        this (for chaining)
      • chunkSize

        public FetchOptions chunkSize(int chunkSize)
        Sets the chunk size. Please read the class javadoc for an explanation of how chunk size is used.
        chunkSize - The chunk size to set. Must be greater than 0.
        this (for chaining)
      • prefetchSize

        public FetchOptions prefetchSize(int prefetchSize)
        Sets the number of entities to prefetch.
        prefetchSize - The prefetch size to set. Must be >= 0.
        this (for chaining)
      • cursor

        public FetchOptions cursor(Cursor cursor)
        Deprecated. use startCursor instead.
        Sets the cursor to start the query from.
        cursor - the cursor to set
        this (for chaining)
      • startCursor

        public FetchOptions startCursor(Cursor startCursor)
        Sets the cursor at which to start the query.
        startCursor - the cursor to set
        this (for chaining)
      • endCursor

        public FetchOptions endCursor(Cursor endCursor)
        Sets the cursor at which to end the query.
        endCursor - the cursor to set
        this (for chaining)
      • getLimit

        public java.lang.Integer getLimit()
        The limit, or null if no limit was provided.
      • getOffset

        public java.lang.Integer getOffset()
        The offset, or null if no offset was provided.
      • getChunkSize

        public java.lang.Integer getChunkSize()
        The chunk size, or null if no chunk size was provided.
      • getPrefetchSize

        public java.lang.Integer getPrefetchSize()
        The prefetch size, or null if no prefetch size was provided.
      • getCursor

        public Cursor getCursor()
        Deprecated. use getStartCursor() instead
        The start cursor, or null if no cursor was provided.
      • getStartCursor

        public Cursor getStartCursor()
        The start cursor, or null if no start cursor was provided.
      • getEndCursor

        public Cursor getEndCursor()
        The end cursor, or null if no end cursor was provided.
      • hashCode

        public int hashCode()
        hashCode in class java.lang.Object
      • equals

        public boolean equals(java.lang.Object obj)
        equals in class java.lang.Object
      • toString

        public java.lang.String toString()
        toString in class java.lang.Object
Оцените, насколько информация на этой странице была вам полезна:

Оставить отзыв о...

Текущей странице
App Engine standard environment for Java 8