Package com.google.cloud
Class ServiceOptions.Builder<ServiceT extends Service<OptionsT>,OptionsT extends ServiceOptions<ServiceT,OptionsT>,B extends ServiceOptions.Builder<ServiceT,OptionsT,B>>
java.lang.Object
com.google.cloud.ServiceOptions.Builder<ServiceT,OptionsT,B>
- Type Parameters:
ServiceT- the service subclassOptionsT- theServiceOptionssubclass corresponding to the serviceB- theServiceOptionsbuilder
- Enclosing class:
- ServiceOptions<ServiceT extends Service<OptionsT>,
OptionsT extends ServiceOptions<ServiceT, OptionsT>>
public abstract static class ServiceOptions.Builder<ServiceT extends Service<OptionsT>,OptionsT extends ServiceOptions<ServiceT,OptionsT>,B extends ServiceOptions.Builder<ServiceT,OptionsT,B>>
extends Object
Builder for
ServiceOptions.-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedBuilder()protectedBuilder(ServiceOptions<ServiceT, OptionsT> options) -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract ServiceOptions<ServiceT,OptionsT> build()protected Bself()setApiTracerFactory(ApiTracerFactory apiTracerFactory) Sets theApiTracerFactory.setClientLibToken(String clientLibToken) Sets the service's clock.setCredentials(com.google.auth.Credentials credentials) Sets the service authentication credentials.setHeaderProvider(HeaderProvider headerProvider) Sets the static header provider.Sets service host.setProjectId(String projectId) Sets the project ID.setQuotaProjectId(String quotaProjectId) Sets the quotaProjectId that specifies the project used for quota and billing purposes.setRetrySettings(RetrySettings retrySettings) Sets configuration parameters for request retries.setServiceFactory(ServiceFactory<ServiceT, OptionsT> serviceFactory) Sets the service factory.setServiceRpcFactory(ServiceRpcFactory<OptionsT> serviceRpcFactory) Sets the factory for rpc services.setTransportOptions(TransportOptions transportOptions) Sets the transport options.setUniverseDomain(String universeDomain) Universe Domain is the domain for Google Cloud Services.
-
Field Details
-
credentials
protected com.google.auth.Credentials credentials
-
-
Constructor Details
-
Builder
-
Builder
@InternalApi("This class should only be extended within google-cloud-java") protected Builder(ServiceOptions<ServiceT, OptionsT> options)
-
-
Method Details
-
build
-
self
-
setServiceFactory
Sets the service factory. -
setClock
Sets the service's clock. The clock is mainly used for testing purpose.ApiClockwill be replaced by Java8'sjava.time.Clock.- Parameters:
clock- the clock to set- Returns:
- the builder
-
setProjectId
Sets the project ID. If no project ID is set,ServiceOptions.getDefaultProjectId()will be used to attempt getting the project ID from the environment.- Returns:
- the builder
-
setHost
Sets service host.- Returns:
- the builder
-
setUniverseDomain
Universe Domain is the domain for Google Cloud Services. A Google Cloud endpoint follows the format of `{ServiceName}.{UniverseDomain}`. For example, speech.googleapis.com would have a Universe Domain value of `googleapis.com` and cloudasset.test.com would have a Universe Domain of `test.com`.If this value is not set, the resolved UniverseDomain will default to `googleapis.com`.
- Throws:
NullPointerException- ifuniverseDomainisnull. The resolved universeDomain will be `googleapis.com` if this value is not set.
-
setCredentials
Sets the service authentication credentials. If no credentials are set,GoogleCredentials.getApplicationDefault()will be used to attempt getting credentials from the environment. UseNoCredentials.getInstance()to skip authentication, this is typically useful when using local service emulators.- Parameters:
credentials- authentication credentials, should not benull- Returns:
- the builder
- Throws:
NullPointerException- ifcredentialsisnull. To disable authentication useNoCredentials.getInstance()
-
setRetrySettings
Sets configuration parameters for request retries.- Returns:
- the builder
-
setServiceRpcFactory
Sets the factory for rpc services.- Returns:
- the builder
-
setTransportOptions
Sets the transport options.- Returns:
- the builder
-
setHeaderProvider
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.- Parameters:
headerProvider- the header provider- Returns:
- the builder
-
setClientLibToken
-
setQuotaProjectId
Sets the quotaProjectId that specifies the project used for quota and billing purposes.- See Also:
-
setApiTracerFactory
Sets theApiTracerFactory. It will be used to create anApiTracerthat is annotated throughout the lifecycle of an RPC operation. -
getAllowedClientLibTokens
-