B
- The type of builder, for chaining.C
- The type of client generated by this builder.public abstract class SdkDefaultClientBuilder<B extends SdkClientBuilder<B,C>,C> extends Object implements SdkClientBuilder<B,C>
SdkClientBuilder
, SdkAsyncClientBuilder
and
SdkSyncClientBuilder
. This implements all methods required by those interfaces, allowing service-specific builders to
just implement the configuration they wish to add.
By implementing both the sync and async interface's methods, service-specific builders can share code between their sync and async variants without needing one to extend the other. Note: This only defines the methods in the sync and async builder interfaces. It does not implement the interfaces themselves. This is because the sync and async client builder interfaces both require a type-constrained parameter for use in fluent chaining, and a generic type parameter conflict is introduced into the class hierarchy by this interface extending the builder interfaces themselves.
Like all SdkClientBuilder
s, this class is not thread safe.
Modifier and Type | Class and Description |
---|---|
static class |
SdkDefaultClientBuilder.NonManagedSdkAsyncHttpClient
Wrapper around
SdkAsyncHttpClient to prevent it from being closed. |
static class |
SdkDefaultClientBuilder.NonManagedSdkHttpClient
Wrapper around
SdkHttpClient to prevent it from being closed. |
Modifier and Type | Field and Description |
---|---|
protected SdkClientConfiguration.Builder |
clientConfiguration |
Modifier | Constructor and Description |
---|---|
protected |
SdkDefaultClientBuilder() |
protected |
SdkDefaultClientBuilder(SdkHttpClient.Builder defaultHttpClientBuilder,
SdkAsyncHttpClient.Builder defaultAsyncHttpClientBuilder) |
Modifier and Type | Method and Description |
---|---|
protected SdkClientConfiguration |
asyncClientConfiguration()
Return a client configuration object, populated with the following chain of priorities.
|
B |
asyncConfiguration(ClientAsyncConfiguration asyncConfiguration) |
C |
build()
Build a client using the current state of this builder.
|
protected abstract C |
buildClient()
Implemented by child classes to create a client using the provided immutable configuration objects.
|
protected AttributeMap |
childHttpConfig()
Optionally overridden by child implementations to provide implementation-specific default HTTP configuration.
|
B |
endpointOverride(URI endpointOverride)
Configure the endpoint with which the SDK should communicate.
|
protected SdkClientConfiguration |
finalizeChildConfiguration(SdkClientConfiguration configuration)
Optionally overridden by child implementations to derive implementation-specific configuration from the
default-applied configuration.
|
B |
httpClient(SdkAsyncHttpClient httpClient) |
B |
httpClient(SdkHttpClient httpClient) |
B |
httpClientBuilder(SdkAsyncHttpClient.Builder httpClientBuilder) |
B |
httpClientBuilder(SdkHttpClient.Builder httpClientBuilder) |
protected SdkClientConfiguration |
mergeChildDefaults(SdkClientConfiguration configuration)
Optionally overridden by child implementations to apply implementation-specific default configuration.
|
B |
metricPublishers(List<MetricPublisher> metricPublishers) |
B |
overrideConfiguration(ClientOverrideConfiguration overrideConfig)
Specify overrides to the default SDK configuration that should be used for clients created by this builder.
|
void |
setAsyncConfiguration(ClientAsyncConfiguration asyncConfiguration) |
void |
setEndpointOverride(URI endpointOverride) |
void |
setOverrideConfiguration(ClientOverrideConfiguration overrideConfiguration) |
protected SdkClientConfiguration |
syncClientConfiguration()
Return a client configuration object, populated with the following chain of priorities.
|
protected B |
thisBuilder()
Return "this" for method chaining.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
overrideConfiguration
applyMutation
protected final SdkClientConfiguration.Builder clientConfiguration
protected SdkDefaultClientBuilder()
protected SdkDefaultClientBuilder(SdkHttpClient.Builder defaultHttpClientBuilder, SdkAsyncHttpClient.Builder defaultAsyncHttpClientBuilder)
public final C build()
buildClient()
method, that
accepts the immutable client configuration generated by this build method.build
in interface Buildable
build
in interface SdkBuilder<B extends SdkClientBuilder<B,C>,C>
protected abstract C buildClient()
protected final SdkClientConfiguration syncClientConfiguration()
protected final SdkClientConfiguration asyncClientConfiguration()
protected SdkClientConfiguration mergeChildDefaults(SdkClientConfiguration configuration)
protected SdkClientConfiguration finalizeChildConfiguration(SdkClientConfiguration configuration)
protected AttributeMap childHttpConfig()
public final B endpointOverride(URI endpointOverride)
SdkClientBuilder
endpointOverride
in interface SdkClientBuilder<B extends SdkClientBuilder<B,C>,C>
public final void setEndpointOverride(URI endpointOverride)
public final B asyncConfiguration(ClientAsyncConfiguration asyncConfiguration)
public final void setAsyncConfiguration(ClientAsyncConfiguration asyncConfiguration)
public final B overrideConfiguration(ClientOverrideConfiguration overrideConfig)
SdkClientBuilder
overrideConfiguration
in interface SdkClientBuilder<B extends SdkClientBuilder<B,C>,C>
public final void setOverrideConfiguration(ClientOverrideConfiguration overrideConfiguration)
public final B httpClient(SdkHttpClient httpClient)
public final B httpClientBuilder(SdkHttpClient.Builder httpClientBuilder)
public final B httpClient(SdkAsyncHttpClient httpClient)
public final B httpClientBuilder(SdkAsyncHttpClient.Builder httpClientBuilder)
public final B metricPublishers(List<MetricPublisher> metricPublishers)
protected B thisBuilder()
Copyright © 2021. All rights reserved.