public static class FirestoreOptions.Builder extends ServiceOptions.Builder<Firestore,FirestoreOptions,FirestoreOptions.Builder>
credentials| 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)
Enables the use of
Timestamps for timestamp fields in
DocumentSnapshots. |
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 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.@Nonnull public FirestoreOptions.Builder setTimestampsInSnapshotsEnabled(boolean value)
Timestamps for timestamp fields in
DocumentSnapshots.
Currently, Firestore returns 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.
Setting setTimestampsInSnapshotsEnabled(true) will cause Firestore to return
Timestamp values instead of Date,
avoiding this kind of problem. To make this work you must also change any code that uses
Date to use Timestamp instead.
NOTE: in the future FirestoreOptions.areTimestampsInSnapshotsEnabled() will default
to true and this option will be removed so you should change your code to use Timestamp now
and opt-in to this new behavior as soon as you can.
value.@Nonnull public FirestoreOptions build()
build in class ServiceOptions.Builder<Firestore,FirestoreOptions,FirestoreOptions.Builder>Copyright © 2019 Google LLC. All rights reserved.