# Class FetchOptions.Builder (5.0.3)

    public static final class FetchOptions.Builder

Contains static creation methods for [FetchOptions](https://docs.cloud.google.com/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.datastore.FetchOptions).

## Inheritance

[java.lang.Object](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html) \> FetchOptions.Builder

## Inherited Members

[Object.clone()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#clone--) [Object.equals(Object)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#equals-java.lang.Object-) [Object.finalize()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#finalize--) [Object.getClass()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#getClass--) [Object.hashCode()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#hashCode--) [Object.notify()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notify--) [Object.notifyAll()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notifyAll--) [Object.toString()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#toString--) [Object.wait()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait--) [Object.wait(long)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-) [Object.wait(long,int)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-int-)

## Static Methods

### withChunkSize(int chunkSize)

    public static FetchOptions withChunkSize(int chunkSize)

Create a [FetchOptions](https://docs.cloud.google.com/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.datastore.FetchOptions) with the given chunk size. Shorthand for `
FetchOptions.withDefaults().chunkSize(...);` Please read the [FetchOptions](https://docs.cloud.google.com/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.datastore.FetchOptions) class
javadoc for an explanation of how chunk size is used.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `chunkSize` | `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` the chunkSize to set. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.datastore.FetchOptions` | The newly created FetchOptions instance. |

### withCursor(Cursor cursor) (deprecated)

    public static FetchOptions withCursor(Cursor cursor)

**Deprecated.** *use [#withStartCursor](https://docs.cloud.google.com/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.datastore.FetchOptions.Builder#com_google_appengine_api_datastore_FetchOptions_Builder_withStartCursor_) instead.*

Create a [FetchOptions](https://docs.cloud.google.com/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.datastore.FetchOptions) with the given cursor. Shorthand for `
FetchOptions.withDefaults().cursor(cursor);`. Please read the [FetchOptions](https://docs.cloud.google.com/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.datastore.FetchOptions)
class javadoc for an explanation of how cursors are used.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `cursor` | `https://docs.cloud.google.com/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.datastore.Cursor` the cursor to set. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.datastore.FetchOptions` | The newly created FetchOptions instance. |

### withDefaults()

    public static FetchOptions withDefaults()

Helper method for creating a [FetchOptions](https://docs.cloud.google.com/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.datastore.FetchOptions) instance with default values. The defaults
are `null` for all values.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.datastore.FetchOptions` |   |

### withEndCursor(Cursor endCursor)

    public static FetchOptions withEndCursor(Cursor endCursor)

Create a [FetchOptions](https://docs.cloud.google.com/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.datastore.FetchOptions) with the given end cursor. Shorthand for `
FetchOptions.withDefaults().endCursor(cursor);`. Please read the [FetchOptions](https://docs.cloud.google.com/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.datastore.FetchOptions)
class javadoc for an explanation of how cursors are used.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `endCursor` | `https://docs.cloud.google.com/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.datastore.Cursor` the cursor to set. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.datastore.FetchOptions` | The newly created FetchOptions instance. |

### withLimit(int limit)

    public static FetchOptions withLimit(int limit)

Create a [FetchOptions](https://docs.cloud.google.com/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.datastore.FetchOptions) with the given limit. Shorthand for `
FetchOptions.withDefaults().limit(...);` Please read the [FetchOptions](https://docs.cloud.google.com/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.datastore.FetchOptions) class
javadoc for an explanation of how limit is used.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `limit` | `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` the limit to set. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.datastore.FetchOptions` | The newly created FetchOptions instance. |

### withOffset(int offset)

    public static FetchOptions withOffset(int offset)

Create a [FetchOptions](https://docs.cloud.google.com/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.datastore.FetchOptions) with the given offset. Shorthand for `
FetchOptions.withDefaults().offset(...);` Please read the [FetchOptions](https://docs.cloud.google.com/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.datastore.FetchOptions) class
javadoc for an explanation of how offset is used.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `offset` | `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` the offset to set. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.datastore.FetchOptions` | The newly created FetchOptions instance. |

### withPrefetchSize(int prefetchSize)

    public static FetchOptions withPrefetchSize(int prefetchSize)

Create a [FetchOptions](https://docs.cloud.google.com/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.datastore.FetchOptions) with the given prefetch size. Shorthand for `
FetchOptions.withDefaults().prefetchSize(...);`. Please read the [FetchOptions](https://docs.cloud.google.com/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.datastore.FetchOptions)
class javadoc for an explanation of how prefetch size is used.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `prefetchSize` | `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` the prefetchSize to set. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.datastore.FetchOptions` | The newly created FetchOptions instance. |

### withStartCursor(Cursor startCursor)

    public static FetchOptions withStartCursor(Cursor startCursor)

Create a [FetchOptions](https://docs.cloud.google.com/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.datastore.FetchOptions) with the given start cursor. Shorthand for `
FetchOptions.withDefaults().startCursor(cursor);`. Please read the [FetchOptions](https://docs.cloud.google.com/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.datastore.FetchOptions)
class javadoc for an explanation of how cursors are used.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `startCursor` | `https://docs.cloud.google.com/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.datastore.Cursor` the cursor to set. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.datastore.FetchOptions` | The newly created FetchOptions instance. |