Package io.token
Class TokenClient.Builder<T extends TokenClient.Builder<T>>
- java.lang.Object
-
- io.token.TokenClient.Builder<T>
-
- Enclosing class:
- TokenClient
public static class TokenClient.Builder<T extends TokenClient.Builder<T>> extends java.lang.Object
Used to create a newTokenClient
instances.
-
-
Field Summary
Fields Modifier and Type Field Description protected CryptoEngineFactory
cryptoEngine
protected java.lang.String
devKey
protected java.util.List<java.lang.String>
featureCodes
protected java.lang.String
hostName
protected int
port
protected io.token.rpc.SslConfig
sslConfig
protected long
timeoutMs
protected TokenClient.TokenCluster
tokenCluster
protected boolean
useSsl
-
Constructor Summary
Constructors Constructor Description Builder()
Creates new builder instance with the defaults initialized.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TokenClient
build()
Builds and returns a newTokenClient
instance.T
connectTo(TokenClient.TokenCluster cluster)
Sets Token cluster to connect to.T
devKey(java.lang.String devKey)
Sets the developer key to be used with the SDK.protected io.grpc.Metadata
getHeaders()
protected java.lang.String
getPlatform()
T
hostName(java.lang.String hostName)
Sets the host name of the Token Gateway Service to connect to.T
port(int port)
Sets the port of the Token Gateway Service to connect to.T
timeout(long timeoutMs)
Sets timeoutMs that is used for the RPC calls.T
withCryptoEngine(CryptoEngineFactory cryptoEngineFactory)
Sets the crypto engine to be used with the SDK.T
withFeatureCodes(java.lang.String... featureCodes)
Sets the feature codes to be used with the client.T
withKeyStore(KeyStore keyStore)
Sets the keystore to be used with the SDK.T
withSslConfig(io.token.rpc.SslConfig sslConfig)
Sets configuration parameters for tls client.
-
-
-
Field Detail
-
port
protected int port
-
useSsl
protected boolean useSsl
-
tokenCluster
protected TokenClient.TokenCluster tokenCluster
-
hostName
protected java.lang.String hostName
-
timeoutMs
protected long timeoutMs
-
cryptoEngine
protected CryptoEngineFactory cryptoEngine
-
devKey
protected java.lang.String devKey
-
sslConfig
protected io.token.rpc.SslConfig sslConfig
-
featureCodes
protected java.util.List<java.lang.String> featureCodes
-
-
Method Detail
-
hostName
public T hostName(java.lang.String hostName)
Sets the host name of the Token Gateway Service to connect to.- Parameters:
hostName
- host name, e.g. 'api.token.io'- Returns:
- this builder instance
-
port
public T port(int port)
Sets the port of the Token Gateway Service to connect to.- Parameters:
port
- port number- Returns:
- this builder instance
-
connectTo
public T connectTo(TokenClient.TokenCluster cluster)
Sets Token cluster to connect to.- Parameters:
cluster
-TokenClient.TokenCluster
instance.- Returns:
- this builder instance
-
timeout
public T timeout(long timeoutMs)
Sets timeoutMs that is used for the RPC calls.- Parameters:
timeoutMs
- RPC call timeoutMs- Returns:
- this builder instance
-
withKeyStore
public T withKeyStore(KeyStore keyStore)
Sets the keystore to be used with the SDK.- Parameters:
keyStore
- the keystore to be used- Returns:
- this builder instance
-
withCryptoEngine
public T withCryptoEngine(CryptoEngineFactory cryptoEngineFactory)
Sets the crypto engine to be used with the SDK.- Parameters:
cryptoEngineFactory
- the crypto engine factory to use- Returns:
- this builder instance
-
withSslConfig
public T withSslConfig(io.token.rpc.SslConfig sslConfig)
Sets configuration parameters for tls client. Can be used to specify specific trusted certificates.- Parameters:
sslConfig
- tls configuration to use- Returns:
- this builder instance
-
devKey
public T devKey(java.lang.String devKey)
Sets the developer key to be used with the SDK.- Parameters:
devKey
- developer key- Returns:
- this builder instance
-
withFeatureCodes
public T withFeatureCodes(java.lang.String... featureCodes)
Sets the feature codes to be used with the client.- Parameters:
featureCodes
- feature codes- Returns:
- this builder instance
-
build
public TokenClient build()
Builds and returns a newTokenClient
instance.- Returns:
TokenClient
instance
-
getHeaders
protected io.grpc.Metadata getHeaders()
-
getPlatform
protected java.lang.String getPlatform()
-
-