ServiceT
- the service subclassOptionsT
- the ServiceOptions
subclass corresponding to the serviceB
- the ServiceOptions
builderpublic abstract static class ServiceOptions.Builder<ServiceT extends Service<OptionsT>,OptionsT extends ServiceOptions<ServiceT,OptionsT>,B extends ServiceOptions.Builder<ServiceT,OptionsT,B>> extends Object
ServiceOptions
.Modifier and Type | Field and Description |
---|---|
protected Credentials |
credentials |
Modifier | Constructor and Description |
---|---|
protected |
Builder() |
protected |
Builder(ServiceOptions<ServiceT,OptionsT> options) |
Modifier and Type | Method and Description |
---|---|
protected abstract ServiceOptions<ServiceT,OptionsT> |
build() |
protected B |
self() |
B |
setClock(com.google.api.core.ApiClock clock)
Sets the service's clock.
|
B |
setCredentials(Credentials credentials)
Sets the service authentication credentials.
|
B |
setHeaderProvider(HeaderProvider headerProvider)
Sets the static header provider.
|
B |
setHost(String host)
Sets service host.
|
B |
setProjectId(String projectId)
Sets the project ID.
|
B |
setRetrySettings(RetrySettings retrySettings)
Sets configuration parameters for request retries.
|
B |
setServiceFactory(ServiceFactory<ServiceT,OptionsT> serviceFactory)
Sets the service factory.
|
B |
setServiceRpcFactory(ServiceRpcFactory<OptionsT> serviceRpcFactory)
Sets the factory for rpc services.
|
B |
setTransportOptions(TransportOptions transportOptions)
Sets the transport options.
|
protected Credentials credentials
@InternalApi(value="This class should only be extended within google-cloud-java") protected Builder()
@InternalApi(value="This class should only be extended within google-cloud-java") protected Builder(ServiceOptions<ServiceT,OptionsT> options)
protected abstract ServiceOptions<ServiceT,OptionsT> build()
protected B self()
public B setServiceFactory(ServiceFactory<ServiceT,OptionsT> serviceFactory)
public B setClock(com.google.api.core.ApiClock clock)
ApiClock
will
be replaced by Java8's java.time.Clock
.clock
- the clock to setpublic B setProjectId(String projectId)
ServiceOptions.getDefaultProjectId()
will be used to
attempt getting the project ID from the environment.public B setCredentials(Credentials credentials)
GoogleCredentials.getApplicationDefault()
will be used to attempt getting credentials from
the environment. Use NoCredentials.getInstance()
to skip authentication, this is
typically useful when using local service emulators.credentials
- authentication credentials, should not be null
NullPointerException
- if credentials
is null
. To disable
authentication use NoCredentials.getInstance()
public B setRetrySettings(RetrySettings retrySettings)
public B setServiceRpcFactory(ServiceRpcFactory<OptionsT> serviceRpcFactory)
public B setTransportOptions(TransportOptions transportOptions)
@BetaApi public B setHeaderProvider(HeaderProvider headerProvider)
headerProvider
- the header providerCopyright © 2019 Google LLC. All rights reserved.