Package com.exonum.client
Class ExonumClient.Builder
java.lang.Object
com.exonum.client.ExonumClient.Builder
- Enclosing interface:
- ExonumClient
public static class ExonumClient.Builder extends Object
Builder class for the Exonum client.
-
Constructor Summary
Constructors Constructor Description Builder()
-
Method Summary
Modifier and Type Method Description ExonumClient
build()
Creates Exonum client instance.ExonumClient.Builder
setExonumHost(String exonumHost)
Sets Exonum host url.ExonumClient.Builder
setExonumHost(URL exonumHost)
Sets Exonum host url.ExonumClient.Builder
setHttpClient(okhttp3.OkHttpClient client)
Sets http client, optional.ExonumClient.Builder
setPrefix(String prefix)
Sets an optional URL prefix to be applied to all requests made by the client.
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
setExonumHost
Sets Exonum host url. -
setExonumHost
Sets Exonum host url.- Throws:
IllegalArgumentException
- if the url is malformed
-
setHttpClient
Sets http client, optional. If not set a default instance of http client will be used.This method provides a flexibility for the Exonum client configuration. Can be helpful, for example, in case a network proxy configuration is needed or request/response logging.
-
setPrefix
Sets an optional URL prefix to be applied to all requests made by the client. Can be helpful in case of using middleware routing proxy on the blockchain node side. There is no prefix by default. -
build
Creates Exonum client instance.- Throws:
IllegalStateException
- if required fields weren't set
-