public final class BrightpearlApiClientFactory extends Object
Constructs a configured BrightpearlApiClient. Supports construction in code using the builder pattern (starting
with brightpearlApiClient()) and usage as a Spring bean factory. For example:
<bean id="brightpearlApiClientFactory" class="BrightpearlApiClientFactory">
<property name="clientFactory" ref="myClientFactory"/>
</bean>
<bean id="brightpearlApiClient"
factory-bean="brightpearlApiClientFactory"
factory-method="build"/>
Defaults are available for all the configuration options so there is no requirement to set any options before building the client instance.
| Constructor and Description |
|---|
BrightpearlApiClientFactory() |
| Modifier and Type | Method and Description |
|---|---|
static BrightpearlApiClientFactory |
brightpearlApiClient()
Static builder method for method chaining, fluent builder style.
|
BrightpearlApiClient |
build()
Constructs the immutable
BrightpearlApiClient with configuration options provided, using defaults for
any not set. |
void |
setClientFactory(ClientFactory clientFactory)
Set the
ClientFactory that will supply Client instances for the execution of HTTP requests. |
void |
setGson(com.google.gson.Gson gson)
Provide a custom GSON instance for serialising JSON request bodies and deserialising JSON responses.
|
void |
setRateLimiter(RateLimiter rateLimiter)
Set the
RateLimiter implementation to be used for monitoring and limiting request throughput. |
BrightpearlApiClientFactory |
withClientFactory(ClientFactory clientFactory)
Set the
ClientFactory that will supply Client instances for the execution of HTTP requests. |
BrightpearlApiClientFactory |
withGson(com.google.gson.Gson gson)
Provide a custom GSON instance for serialising JSON request bodies and deserialising JSON responses.
|
BrightpearlApiClientFactory |
withRateLimiter(RateLimiter rateLimiter)
Set the
RateLimiter implementation to be used for monitoring and limiting request throughput. |
public static BrightpearlApiClientFactory brightpearlApiClient()
BrightpearlApiClientFactory instance.public BrightpearlApiClient build()
BrightpearlApiClient with configuration options provided, using defaults for
any not set.BrightpearlApiClient instance.public void setClientFactory(ClientFactory clientFactory)
ClientFactory that will supply Client instances for the execution of HTTP requests. By
default, an Apache HTTP Components implementation is used, with a dependency on org.apache.httpcomponents:httpclient:4.2.5.
This may be replaced with another implementation when required.clientFactory - custom client factory implementation.public void setRateLimiter(RateLimiter rateLimiter)
RateLimiter implementation to be used for monitoring and limiting request throughput. By default,
a no-op implementation is used, which places no restrictions on the number of requests made.rateLimiter - custom rate limiter implementation.public void setGson(com.google.gson.Gson gson)
Calendars as ISO dates.gson - a custom configured GSON instance.public BrightpearlApiClientFactory withClientFactory(ClientFactory clientFactory)
ClientFactory that will supply Client instances for the execution of HTTP requests. By
default, an Apache HTTP Components implementation is used, with a dependency on org.apache.httpcomponents:httpclient:4.2.5.
This may be replaced with another implementation when required.clientFactory - custom client factory implementation.public BrightpearlApiClientFactory withRateLimiter(RateLimiter rateLimiter)
RateLimiter implementation to be used for monitoring and limiting request throughput. By default,
a no-op implementation is used, which places no restrictions on the number of requests made.rateLimiter - custom rate limiter implementation.public BrightpearlApiClientFactory withGson(com.google.gson.Gson gson)
Calendars as ISO dates.gson - a custom configured GSON instance.Copyright © 2014. All Rights Reserved.