Package com.exonum.client
Class ExonumClient.Builder
java.lang.Object
com.exonum.client.ExonumClient.Builder
- Enclosing interface:
- ExonumClient
public static class ExonumClient.Builder
extends java.lang.Object
Builder class for the Exonum client.
-
Constructor Summary
Constructors Constructor Description Builder() -
Method Summary
Modifier and Type Method Description ExonumClientbuild()Creates Exonum client instance.ExonumClient.BuildersetExonumHost(java.lang.String exonumHost)Sets the Exonum host url.ExonumClient.BuildersetExonumHost(java.net.URL exonumHost)Sets the Exonum host url.ExonumClient.BuildersetHttpClient(okhttp3.OkHttpClient client)Sets http client, optional.ExonumClient.BuildersetPrefix(java.lang.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 the Exonum host url.- Parameters:
exonumHost- Exonum public API address- See Also:
- API Configuration, Exonum Node Configuraion
-
setExonumHost
Sets the Exonum host url.- Parameters:
exonumHost- Exonum public API address- Throws:
java.lang.IllegalArgumentException- if the url is malformed- See Also:
setExonumHost(URL)
-
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:
java.lang.IllegalStateException- if required fields weren't set
-