Package com.faunadb.client
Class FaunaClient.Builder
- java.lang.Object
-
- com.faunadb.client.FaunaClient.Builder
-
- Enclosing class:
- FaunaClient
public static final class FaunaClient.Builder extends Object
A builder for creating an instance ofFaunaClient
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description FaunaClient
build()
Returns a newly constructedFaunaClient
with configuration based on the settings of thisFaunaClient.Builder
.FaunaClient.Builder
withCheckNewVersion(boolean checkNewVersion)
Sets the checkNewVersion variable for checking latets driver versionFaunaClient.Builder
withCustomHeaders(Map<String,String> headers)
Sets user defined headers that will be sent with each http request to fauna db serverFaunaClient.Builder
withEndpoint(String endpoint)
Sets the FaunaDB endpoint url for theFaunaClient
instance.FaunaClient.Builder
withMetrics(MetricRegistry registry)
Sets aMetricRegistry
that theFaunaClient
will use to register and track Connection-level statistics.FaunaClient.Builder
withQueryTimeout(Duration timeout)
Sets a global timeout for all the Queries issued by this client.FaunaClient.Builder
withSecret(String secret)
Sets the secret to be passed to FaunaDB as a authentication tokenFaunaClient.Builder
withUserAgent(String userAgent)
Sets the User-Agent header for all the Queries issued by this client.
-
-
-
Method Detail
-
withSecret
public FaunaClient.Builder withSecret(String secret)
Sets the secret to be passed to FaunaDB as a authentication token- Parameters:
secret
- the auth token secret- Returns:
- this
FaunaClient.Builder
object
-
withEndpoint
public FaunaClient.Builder withEndpoint(String endpoint) throws MalformedURLException
Sets the FaunaDB endpoint url for theFaunaClient
instance.- Parameters:
endpoint
- the root endpoint URL- Returns:
- this
FaunaClient.Builder
object - Throws:
MalformedURLException
- if the endpoint is invalid
-
withMetrics
public FaunaClient.Builder withMetrics(MetricRegistry registry)
Sets aMetricRegistry
that theFaunaClient
will use to register and track Connection-level statistics.- Parameters:
registry
- theMetricRegistry
instance.- Returns:
- this
FaunaClient.Builder
object
-
withQueryTimeout
public FaunaClient.Builder withQueryTimeout(Duration timeout)
Sets a global timeout for all the Queries issued by this client.- Parameters:
timeout
- the query timeout value. The timeout value has milliseconds precision.- Returns:
- this
FaunaClient.Builder
object
-
withUserAgent
public FaunaClient.Builder withUserAgent(String userAgent)
Sets the User-Agent header for all the Queries issued by this client.- Parameters:
userAgent
- the userAgent value- Returns:
- this
FaunaClient.Builder
object
-
withCheckNewVersion
public FaunaClient.Builder withCheckNewVersion(boolean checkNewVersion)
Sets the checkNewVersion variable for checking latets driver version- Parameters:
checkNewVersion
-- Returns:
- this
Connection.Builder
object
-
withCustomHeaders
public FaunaClient.Builder withCustomHeaders(Map<String,String> headers)
Sets user defined headers that will be sent with each http request to fauna db server- Parameters:
headers
- a map of key-value pairs- Returns:
- this
Connection.Builder
object
-
build
public FaunaClient build()
Returns a newly constructedFaunaClient
with configuration based on the settings of thisFaunaClient.Builder
.- Returns:
FaunaClient
-
-