Package com.faunadb.common
Class Connection.Builder
- java.lang.Object
-
- com.faunadb.common.Connection.Builder
-
- Enclosing class:
- Connection
public static class Connection.Builder extends Object
A builder for theConnectioninstance. Use theConnection.builder()method to create an instance of theConnection.Builderclass.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Connectionbuild()Connection.BuilderwithAuthToken(String token)Sets the authentication token or key for theConnectioninstance.Connection.BuilderwithFaunaRoot(String root)Sets the FaunaDB root URL for theConnectioninstance.Connection.BuilderwithFaunaRoot(URL root)Sets the FaunaDB root URL for theConnectioninstance.Connection.BuilderwithHttpClient(HttpClient client)Sets the client to use for the connection.Connection.BuilderwithJvmDriver(Connection.JvmDriver jvmDriver)Sets the Fauna driver to use for the connection.Connection.BuilderwithLastSeenTxn(long txnTime)Sets the last seen transaction time for the connection.Connection.BuilderwithMetrics(MetricRegistry registry)Sets aMetricRegistryfor theConnectioninstance.Connection.BuilderwithQueryTimeout(Duration timeout)Sets the global query timeout for this connection.Connection.BuilderwithScalaVersion(String scalaVersion)Sets the Scala version to use for a requests headerConnection.BuilderwithUserAgent(String userAgent)Sets the User-Agent header for this connection.
-
-
-
Method Detail
-
withFaunaRoot
public Connection.Builder withFaunaRoot(String root) throws MalformedURLException
Sets the FaunaDB root URL for theConnectioninstance.- Parameters:
root- the root URL, as a RFC 2396 formatted string. Example: https://db.fauna.com- Returns:
- this
Connection.Builderobject - Throws:
MalformedURLException- if a malformed url is provided
-
withFaunaRoot
public Connection.Builder withFaunaRoot(URL root)
Sets the FaunaDB root URL for theConnectioninstance.- Parameters:
root- the root URL- Returns:
- this
Connection.Builderobject
-
withAuthToken
public Connection.Builder withAuthToken(String token)
Sets the authentication token or key for theConnectioninstance.- Parameters:
token- the auth token or key- Returns:
- this
Connection.Builderobject
-
withMetrics
public Connection.Builder withMetrics(MetricRegistry registry)
Sets aMetricRegistryfor theConnectioninstance. TheMetricRegistrywill be used to track connection level statistics.- Parameters:
registry- theMetricRegistryinstance.- Returns:
- this
Connection.Builderobject
-
withJvmDriver
public Connection.Builder withJvmDriver(Connection.JvmDriver jvmDriver)
Sets the Fauna driver to use for the connection.- Parameters:
jvmDriver- theConnection.JvmDriverto use for this connection.- Returns:
- this
Connection.Builderobject
-
withScalaVersion
public Connection.Builder withScalaVersion(String scalaVersion)
Sets the Scala version to use for a requests header- Parameters:
scalaVersion-- Returns:
- this
Connection.Builderobject
-
withLastSeenTxn
public Connection.Builder withLastSeenTxn(long txnTime)
Sets the last seen transaction time for the connection.- Parameters:
txnTime- the last seen transaction time in microseconds.- Returns:
- this
Connection.Builderobject
-
withHttpClient
public Connection.Builder withHttpClient(HttpClient client)
Sets the client to use for the connection.- Parameters:
client- theHttpClientto use for this connection.- Returns:
- this
Connection.Builderobject
-
withQueryTimeout
public Connection.Builder withQueryTimeout(Duration timeout)
Sets the global query timeout for this connection.- Parameters:
timeout- the query timeout value- Returns:
- this
Connection.Builderobject
-
withUserAgent
public Connection.Builder withUserAgent(String userAgent)
Sets the User-Agent header for this connection.- Parameters:
userAgent- the query timeout value- Returns:
- this
Connection.Builderobject
-
build
public Connection build()
- Returns:
- a newly constructed
Connectionwith its configuration based on the settings of theConnection.Builderinstance.
-
-