Class StubSettings.Builder<SettingsT extends StubSettings<SettingsT>,B extends StubSettings.Builder<SettingsT,B>>

java.lang.Object
com.google.api.gax.rpc.StubSettings.Builder<SettingsT,B>
Enclosing class:
StubSettings<SettingsT extends StubSettings<SettingsT>>

public abstract static class StubSettings.Builder<SettingsT extends StubSettings<SettingsT>,B extends StubSettings.Builder<SettingsT,B>> extends Object
  • Constructor Details

    • Builder

      protected Builder(StubSettings settings)
      Create a builder from a StubSettings object.
    • Builder

      protected Builder(ClientContext clientContext)
    • Builder

      protected Builder()
  • Method Details

    • self

      protected B self()
    • setExecutorProvider

      @Deprecated public B setExecutorProvider(ExecutorProvider executorProvider)
      Deprecated.
      Please use setBackgroundExecutorProvider(ExecutorProvider) for setting executor to use for running scheduled API call logic. To set executor for TransportChannelProvider, please use TransportChannelProvider.withExecutor(Executor) instead.
      Sets the ExecutorProvider to use for getting the executor to use for running asynchronous API call logic (such as retries and long-running operations), and also to pass to the transport settings if an executor is needed for the transport and it doesn't have its own executor provider.
    • setBackgroundExecutorProvider

      public B setBackgroundExecutorProvider(ExecutorProvider backgroundExecutorProvider)
      Sets the executor to use for running scheduled API call logic (such as retries and long-running operations).
    • setCredentialsProvider

      public B setCredentialsProvider(CredentialsProvider credentialsProvider)
      Sets the CredentialsProvider to use for getting the credentials to make calls with.
    • setHeaderProvider

      public B setHeaderProvider(HeaderProvider headerProvider)
      Sets the HeaderProvider for getting custom static headers for http requests. 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.
    • setInternalHeaderProvider

      protected B setInternalHeaderProvider(HeaderProvider internalHeaderProvider)
      Sets the HeaderProvider for getting internal (library-defined) static headers for http requests. 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.
    • setTransportChannelProvider

      public B setTransportChannelProvider(TransportChannelProvider transportChannelProvider)
      Sets the TransportProvider to use for getting the transport-specific context to make calls with.
    • setStreamWatchdogProvider

      public B setStreamWatchdogProvider(@Nullable WatchdogProvider streamWatchdogProvider)
      Sets the WatchdogProvider to use for streaming RPC.

      This will default to a InstantiatingWatchdogProvider if it is not set.

    • setClock

      public B setClock(ApiClock clock)
      Sets the clock to use for retry logic.

      This will default to a system clock if it is not set.

    • setUniverseDomain

      public B setUniverseDomain(String universeDomain)
    • setEndpoint

      public B setEndpoint(String endpoint)
    • setSwitchToMtlsEndpointAllowed

      protected B setSwitchToMtlsEndpointAllowed(boolean switchToMtlsEndpointAllowed)
    • setMtlsEndpoint

      public B setMtlsEndpoint(String mtlsEndpoint)
    • setQuotaProjectId

      public B setQuotaProjectId(String quotaProjectId)
    • setStreamWatchdogCheckInterval

      @ObsoleteApi("Use setStreamWatchdogCheckIntervalDuration(java.time.Duration) instead") public B setStreamWatchdogCheckInterval(@Nonnull org.threeten.bp.Duration checkInterval)
    • setStreamWatchdogCheckIntervalDuration

      public B setStreamWatchdogCheckIntervalDuration(@Nonnull Duration checkInterval)
      Sets how often the Watchdog will check ongoing streaming RPCs. Defaults to 10 secs. Use Duration.ZERO to disable.
    • setGdchApiAudience

      public B setGdchApiAudience(String gdchApiAudience)
      Sets the API audience used by GdchCredentials It cannot be used if other type of Credentials is used. If the provided credentials already have an api audience set, then it will be overriden by this audience
      Parameters:
      gdchApiAudience - the audience to be used - must be a valid URI string
    • setTracerFactory

      @BetaApi("The surface for tracing is not stable yet and may change in the future.") public B setTracerFactory(@Nonnull ApiTracerFactory tracerFactory)
      Configures the ApiTracerFactory that will be used to generate traces.
      Parameters:
      tracerFactory - an instance of ApiTracerFactory to set.
    • setApiKey

      public B setApiKey(String apiKey)
      Sets the API key. The API key will get translated to an ApiKeyCredentials and stored in ClientContext.

      API Key authorization is not supported for every product. Please check the documentation for each product to confirm if it is supported.

      Note: If you set an API key and CredentialsProvider in the same ClientSettings the API key will override any credentials provided.

    • getExecutorProvider

      @Deprecated public ExecutorProvider getExecutorProvider()
      Deprecated.
    • getBackgroundExecutorProvider

      public ExecutorProvider getBackgroundExecutorProvider()
      Gets the ExecutorProvider that was previously set on this Builder.
    • getTransportChannelProvider

      public TransportChannelProvider getTransportChannelProvider()
      Gets the TransportProvider that was previously set on this Builder.
    • getCredentialsProvider

      public CredentialsProvider getCredentialsProvider()
      Gets the CredentialsProvider that was previously set on this Builder.
    • getHeaderProvider

      public HeaderProvider getHeaderProvider()
      Gets the custom HeaderProvider that was previously set on this Builder.
    • getInternalHeaderProvider

      protected HeaderProvider getInternalHeaderProvider()
      Gets the internal HeaderProvider that was previously set on this Builder.
    • getStreamWatchdogProvider

      @Nullable public WatchdogProvider getStreamWatchdogProvider()
      Gets the WatchdogProviderthat was previously set on this Builder.
    • getClock

      public ApiClock getClock()
      Gets the ApiClock that was previously set on this Builder.
    • getApiKey

      public final String getApiKey()
      Gets the API Key that was previously set on this Builder.
    • getEndpoint

      public String getEndpoint()
      Returns:
      the resolved endpoint when the Builder was created. If invoked after `StubSettings.newBuilder()` is called, it will return the clientSettingsEndpoint value. If other parameters are then set in the builder, the resolved endpoint is not automatically updated. The resolved endpoint will only be recomputed when the StubSettings is built again.
    • getMtlsEndpoint

      public String getMtlsEndpoint()
    • getQuotaProjectId

      public String getQuotaProjectId()
      Gets the QuotaProjectId that was previously set on this Builder.
    • getStreamWatchdogCheckInterval

      @ObsoleteApi("Use getStreamWatchdogCheckIntervalDuration() instead") public org.threeten.bp.Duration getStreamWatchdogCheckInterval()
      This method is obsolete. Use getStreamWatchdogCheckIntervalDuration() instead
    • getStreamWatchdogCheckIntervalDuration

      @Nonnull public Duration getStreamWatchdogCheckIntervalDuration()
    • getTracerFactory

      @BetaApi("The surface for tracing is not stable yet and may change in the future.") @Nonnull public ApiTracerFactory getTracerFactory()
    • getGdchApiAudience

      public String getGdchApiAudience()
      Gets the GDCH API audience that was previously set in this Builder
    • applyToAllUnaryMethods

      protected static void applyToAllUnaryMethods(Iterable<UnaryCallSettings.Builder<?,?>> methodSettingsBuilders, ApiFunction<UnaryCallSettings.Builder<?,?>,Void> settingsUpdater)
      Applies the given settings updater function to the given method settings builders.
    • build

      public abstract <B extends StubSettings<B>> StubSettings<B> build() throws IOException
      Throws:
      IOException
    • toString

      public String toString()
      Overrides:
      toString in class Object