Class ServiceOptions.Builder<ServiceT,OptionsT,B> (2.9.4)

public abstract static class ServiceOptions.Builder<ServiceT,OptionsT,B>

Builder for ServiceOptions.

Inheritance

java.lang.Object > ServiceOptions.Builder<ServiceT,OptionsT,B>

Type Parameters

NameDescription
ServiceT
OptionsT
B

Constructors

Builder()

protected Builder()

Builder(ServiceOptions<ServiceT,OptionsT> options)

protected Builder(ServiceOptions<ServiceT,OptionsT> options)
Parameter
NameDescription
optionsServiceOptions<ServiceT,OptionsT>

Fields

credentials

protected Credentials credentials
Field Value
TypeDescription
com.google.auth.Credentials

Methods

build()

protected abstract ServiceOptions<ServiceT,OptionsT> build()
Returns
TypeDescription
ServiceOptions<ServiceT,OptionsT>

getAllowedClientLibTokens()

protected Set<String> getAllowedClientLibTokens()
Returns
TypeDescription
Set<String>

self()

protected B self()
Returns
TypeDescription
B

setClientLibToken(String clientLibToken)

public B setClientLibToken(String clientLibToken)
Parameter
NameDescription
clientLibTokenString
Returns
TypeDescription
B

setClock(ApiClock clock)

public B setClock(ApiClock clock)

Sets the service's clock. The clock is mainly used for testing purpose. ApiClock will be replaced by Java8's java.time.Clock.

Parameter
NameDescription
clockApiClock

the clock to set

Returns
TypeDescription
B

the builder

setCredentials(Credentials credentials)

public B setCredentials(Credentials credentials)

Sets the service authentication credentials. If no credentials are set, 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.

Parameter
NameDescription
credentialscom.google.auth.Credentials

authentication credentials, should not be null

Returns
TypeDescription
B

the builder

setHeaderProvider(HeaderProvider headerProvider)

public B setHeaderProvider(HeaderProvider headerProvider)

Sets the static header provider. The header provider will be called during client construction only once. The headers returned by the provider will be cached and supplied as is for each request issued by the constructed client. Some reserved headers can be overridden (e.g. Content-Type) or merged with the default value (e.g. User-Agent) by the underlying transport layer.

Parameter
NameDescription
headerProviderHeaderProvider

the header provider

Returns
TypeDescription
B

the builder

setHost(String host)

public B setHost(String host)

Sets service host.

Parameter
NameDescription
hostString
Returns
TypeDescription
B

the builder

setProjectId(String projectId)

public B setProjectId(String projectId)

Sets the project ID. If no project ID is set, #getDefaultProjectId() will be used to attempt getting the project ID from the environment.

Parameter
NameDescription
projectIdString
Returns
TypeDescription
B

the builder

setQuotaProjectId(String quotaProjectId)

public B setQuotaProjectId(String quotaProjectId)

Sets the quotaProjectId that specifies the project used for quota and billing purposes. See Also: See system parameter $userProject

Parameter
NameDescription
quotaProjectIdString
Returns
TypeDescription
B

setRetrySettings(RetrySettings retrySettings)

public B setRetrySettings(RetrySettings retrySettings)

Sets configuration parameters for request retries.

Parameter
NameDescription
retrySettingsRetrySettings
Returns
TypeDescription
B

the builder

setServiceFactory(ServiceFactory<ServiceT,OptionsT> serviceFactory)

public B setServiceFactory(ServiceFactory<ServiceT,OptionsT> serviceFactory)

Sets the service factory.

Parameter
NameDescription
serviceFactoryServiceFactory<ServiceT,OptionsT>
Returns
TypeDescription
B

setServiceRpcFactory(ServiceRpcFactory<OptionsT> serviceRpcFactory)

public B setServiceRpcFactory(ServiceRpcFactory<OptionsT> serviceRpcFactory)

Sets the factory for rpc services.

Parameter
NameDescription
serviceRpcFactoryServiceRpcFactory<OptionsT>
Returns
TypeDescription
B

the builder

setTransportOptions(TransportOptions transportOptions)

public B setTransportOptions(TransportOptions transportOptions)

Sets the transport options.

Parameter
NameDescription
transportOptionsTransportOptions
Returns
TypeDescription
B

the builder