Class DatabaseOptions
java.lang.Object
com.datastax.astra.client.core.options.BaseOptions<DatabaseOptions>
com.datastax.astra.client.databases.DatabaseOptions
- All Implemented Interfaces:
Cloneable
Represents the configuration options required to connect to a database. This class encapsulates
various settings, such as authentication details, API version, and keyspace configuration,
enabling flexible and customized database connections.
If not explicitly provided, default options will be used. This ensures ease of use for developers while still allowing fine-grained control over the connection configuration when needed.
This class is annotated with @Setter
and @Accessors(fluent = true, chain = true)
,
enabling a fluent, chainable API for setting properties.
Key Features:
- Fluent setters for convenient configuration of options.
- Support for default configurations when options are not specified.
- Encapsulation of essential parameters such as keyspace, API version, and authentication token.
Example usage:
// Create a DatabaseOptions object with custom settings
DatabaseOptions options = new DatabaseOptions()
.keyspace("my_keyspace")
.authToken("my_auth_token")
.apiVersion("v2")
.logRequests(true);
// Use the options when initializing a Database instance
Database database = new Database("https://my-endpoint.com", options);
-
Field Summary
Fields inherited from class com.datastax.astra.client.core.options.BaseOptions
commandType, dataAPIClientOptions, serializer, token
-
Constructor Summary
ConstructorDescriptionDefault constructor.DatabaseOptions
(String token, DataAPIClientOptions options) Constructor with options and not token override. -
Method Summary
Methods inherited from class com.datastax.astra.client.core.options.BaseOptions
adminAdditionalHeaders, commandType, dataAPIClientOptions, databaseAdditionalHeaders, embeddingApiKey, embeddingAuthProvider, getCommandType, getDataAPIClientOptions, getRequestTimeout, getRequestTimeout, getSerializer, getTimeout, getTimeout, getToken, httpClientOptions, registerObserver, serializer, timeout, timeout, timeout, timeoutOptions, token, toString, unregisterObserver
-
Constructor Details
-
DatabaseOptions
public DatabaseOptions()Default constructor. -
DatabaseOptions
Constructor with options and not token override.- Parameters:
token
- authentication tokenoptions
- data API client options
-
-
Method Details
-
getKeyspace
Gets keyspace- Returns:
- value of keyspace
-
clone
- Overrides:
clone
in classBaseOptions<DatabaseOptions>
-