public static class FirestoreOptions.Builder extends ServiceOptions.Builder<Firestore,FirestoreOptions,FirestoreOptions.Builder>
credentials
Modifier and Type | Method and Description |
---|---|
FirestoreOptions |
build() |
FirestoreOptions.Builder |
setChannelProvider(TransportChannelProvider channelProvider)
Sets the
TransportChannelProvider to use with this Firestore client. |
FirestoreOptions.Builder |
setCredentialsProvider(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(TransportOptions transportOptions)
Sets the
TransportOptions to use with this Firestore client. |
self, setClock, setCredentials, setHeaderProvider, setHost, setProjectId, setRetrySettings, setServiceFactory, setServiceRpcFactory
@Nonnull public FirestoreOptions.Builder setTransportOptions(@Nonnull TransportOptions transportOptions)
TransportOptions
to use with this Firestore client.setTransportOptions
in class ServiceOptions.Builder<Firestore,FirestoreOptions,FirestoreOptions.Builder>
transportOptions
- A GrpcTransportOptions object that defines the transport options for
this client.@Nonnull public FirestoreOptions.Builder setChannelProvider(@Nonnull 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 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 ServiceOptions.Builder<Firestore,FirestoreOptions,FirestoreOptions.Builder>
Copyright © 2019 Google LLC. All rights reserved.