public static class FirestoreOptions.Builder extends com.google.cloud.ServiceOptions.Builder<Firestore,FirestoreOptions,FirestoreOptions.Builder>
Modifier and Type | Class and Description |
---|---|
class |
FirestoreOptions.Builder.FakeCredentials |
Modifier and Type | Method and Description |
---|---|
FirestoreOptions |
build() |
FirestoreOptions.Builder |
setChannelProvider(com.google.api.gax.rpc.TransportChannelProvider channelProvider)
Sets the
TransportChannelProvider to use with this Firestore client. |
FirestoreOptions.Builder |
setCredentialsProvider(com.google.api.gax.core.CredentialsProvider credentialsProvider)
Sets the
CredentialsProvider to use with this Firestore client. |
FirestoreOptions.Builder |
setDatabaseId(String databaseId)
Sets the database ID to use with this Firestore client.
|
FirestoreOptions.Builder |
setTimestampsInSnapshotsEnabled(boolean value)
Deprecated.
This setting now defaults to true and will be removed in a future release. If you
are already setting it to true, just remove the setting. If you are setting it to false,
you should update your code to expect
Timestamps
instead of Dates and then remove the setting. |
FirestoreOptions.Builder |
setTransportOptions(com.google.cloud.TransportOptions transportOptions)
Sets the
TransportOptions to use with this Firestore client. |
@Nonnull public FirestoreOptions.Builder setTransportOptions(@Nonnull com.google.cloud.TransportOptions transportOptions)
TransportOptions
to use with this Firestore client.setTransportOptions
in class com.google.cloud.ServiceOptions.Builder<Firestore,FirestoreOptions,FirestoreOptions.Builder>
transportOptions
- A GrpcTransportOptions object that defines the transport options for
this client.@Nonnull public FirestoreOptions.Builder setChannelProvider(@Nonnull com.google.api.gax.rpc.TransportChannelProvider channelProvider)
TransportChannelProvider
to use with this Firestore client.channelProvider
- A InstantiatingGrpcChannelProvider object that defines the transport
provider for this client.@Nonnull public FirestoreOptions.Builder setCredentialsProvider(@Nonnull com.google.api.gax.core.CredentialsProvider credentialsProvider)
CredentialsProvider
to use with this Firestore client.credentialsProvider
- A CredentialsProvider object that defines the credential provider
for this client.public FirestoreOptions.Builder setDatabaseId(@Nonnull String databaseId)
databaseId
- The Firestore database ID to use with this client.@Deprecated @Nonnull public FirestoreOptions.Builder setTimestampsInSnapshotsEnabled(boolean value)
Timestamps
instead of Dates
and then remove the setting.Timestamps
for timestamp fields
in DocumentSnapshots
. This is now enabled by default and should not
be disabled.
Previously, Firestore returned timestamp fields as Date
but Date
only supports millisecond precision, which leads to truncation and causes
unexpected behavior when using a timestamp from a snapshot as a part of a subsequent query.
So now Firestore returns Timestamp
values instead of
Date
, avoiding this kind of problem.
To opt into the old behavior of returning Dates
, you can
temporarily set FirestoreOptions.areTimestampsInSnapshotsEnabled()
to false.
@Nonnull public FirestoreOptions build()
build
in class com.google.cloud.ServiceOptions.Builder<Firestore,FirestoreOptions,FirestoreOptions.Builder>
Copyright © 2019 Google LLC. All rights reserved.