Class Configuration.Builder
- Enclosing class:
Configuration
To use this, call Configuration.Builder.create() then chain one or more builder methods.
The only required method is withCredentials(String, String).
-
Method Summary
Modifier and TypeMethodDescriptionbuild()Creates a Configuration instance.static ConfigurationbuildDefault(String username, String password) Creates a new configuration instance using default values (default host and no proxy).static Configuration.Buildercreate()withCredentials(String username, String password) Set a username and password to authenticate against the APIAllow you to define a hostname that the client will use.Allow you to define a proxy (if it is required by your organisation).withRetryStrategy(int numberOfRetries, int intervalInMs) Set a retry strategy to make every call resilient of unexpected issues.withTimeout(int connectionTimeoutInMs, int requestTimeoutInMs) Set timeout values
-
Method Details
-
create
-
withCredentials
Set a username and password to authenticate against the APIThis was provided to you by Commuty.
- Parameters:
username- The username Commuty provided to you.password- The password Commuty provided to you.- Returns:
- this builder instance.
-
withHost
Allow you to define a hostname that the client will use.
If you do not call this method, the client will use the default production parking api of Commuty.
Unless the Commuty Team tells you otherwise, you don't need to use this method.
- Parameters:
host- a valid URL- Returns:
- this builder instance.
-
withProxy
Allow you to define a proxy (if it is required by your organisation).
Pass a proxy instance to the method, i.e:
new Proxy(Proxy.Type.HTTP, new InetSocketAddress("10.0.0.1", 8080));- Parameters:
proxy- a validProxyobject.- Returns:
- this builder instance.
-
withRetryStrategy
Set a retry strategy to make every call resilient of unexpected issues.- Parameters:
numberOfRetries- The number of calls that must be attempted every time the API is contacted. Must be positive.intervalInMs- The time to wait (in milliseconds) between each attempt. Must be positive.- Returns:
- this builder instance.
-
withTimeout
Set timeout values- Parameters:
connectionTimeoutInMs- The duration in milliseconds the client will wait during the connection phase of an HTTP Call to the API. Must be positive.requestTimeoutInMs- The maximum duration in milliseconds the client will wait for a response of a GET HTTP Call to the API. Must be positive.- Returns:
- this builder instance.
-
build
Creates a Configuration instance.- Returns:
- a new Configuration that will allow you to create a Rest client.
-
buildDefault
Creates a new configuration instance using default values (default host and no proxy).
In most cases, you will need only this method to create a Configuration object.
- Parameters:
username- The username Commuty provided to you.password- The password Commuty provided to you.- Returns:
- a new Configuration that will allow you to create a Rest client.
-