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 theConnection
instance. Use theConnection.builder()
method to create an instance of theConnection.Builder
class.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Connection
build()
Connection.Builder
withAuthToken(String token)
Sets the authentication token or key for theConnection
instance.Connection.Builder
withFaunaRoot(String root)
Sets the FaunaDB root URL for theConnection
instance.Connection.Builder
withFaunaRoot(URL root)
Sets the FaunaDB root URL for theConnection
instance.Connection.Builder
withHttpClient(HttpClient client)
Sets the client to use for the connection.Connection.Builder
withJvmDriver(Connection.JvmDriver jvmDriver)
Sets the Fauna driver to use for the connection.Connection.Builder
withLastSeenTxn(long txnTime)
Sets the last seen transaction time for the connection.Connection.Builder
withMetrics(MetricRegistry registry)
Sets aMetricRegistry
for theConnection
instance.Connection.Builder
withQueryTimeout(Duration timeout)
Sets the global query timeout for this connection.Connection.Builder
withScalaVersion(String scalaVersion)
Sets the Scala version to use for a requests headerConnection.Builder
withUserAgent(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 theConnection
instance.- Parameters:
root
- the root URL, as a RFC 2396 formatted string. Example: https://db.fauna.com- Returns:
- this
Connection.Builder
object - Throws:
MalformedURLException
- if a malformed url is provided
-
withFaunaRoot
public Connection.Builder withFaunaRoot(URL root)
Sets the FaunaDB root URL for theConnection
instance.- Parameters:
root
- the root URL- Returns:
- this
Connection.Builder
object
-
withAuthToken
public Connection.Builder withAuthToken(String token)
Sets the authentication token or key for theConnection
instance.- Parameters:
token
- the auth token or key- Returns:
- this
Connection.Builder
object
-
withMetrics
public Connection.Builder withMetrics(MetricRegistry registry)
Sets aMetricRegistry
for theConnection
instance. TheMetricRegistry
will be used to track connection level statistics.- Parameters:
registry
- theMetricRegistry
instance.- Returns:
- this
Connection.Builder
object
-
withJvmDriver
public Connection.Builder withJvmDriver(Connection.JvmDriver jvmDriver)
Sets the Fauna driver to use for the connection.- Parameters:
jvmDriver
- theConnection.JvmDriver
to use for this connection.- Returns:
- this
Connection.Builder
object
-
withScalaVersion
public Connection.Builder withScalaVersion(String scalaVersion)
Sets the Scala version to use for a requests header- Parameters:
scalaVersion
-- Returns:
- this
Connection.Builder
object
-
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.Builder
object
-
withHttpClient
public Connection.Builder withHttpClient(HttpClient client)
Sets the client to use for the connection.- Parameters:
client
- theHttpClient
to use for this connection.- Returns:
- this
Connection.Builder
object
-
withQueryTimeout
public Connection.Builder withQueryTimeout(Duration timeout)
Sets the global query timeout for this connection.- Parameters:
timeout
- the query timeout value- Returns:
- this
Connection.Builder
object
-
withUserAgent
public Connection.Builder withUserAgent(String userAgent)
Sets the User-Agent header for this connection.- Parameters:
userAgent
- the query timeout value- Returns:
- this
Connection.Builder
object
-
build
public Connection build()
- Returns:
- a newly constructed
Connection
with its configuration based on the settings of theConnection.Builder
instance.
-
-