Class DatabaseOptions

java.lang.Object
com.datastax.astra.client.core.options.BaseOptions<DatabaseOptions>
com.datastax.astra.client.databases.DatabaseOptions
All Implemented Interfaces:
Cloneable

public class DatabaseOptions extends BaseOptions<DatabaseOptions> implements 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);
 
 
  • Constructor Details

    • DatabaseOptions

      public DatabaseOptions()
      Default constructor.
    • DatabaseOptions

      public DatabaseOptions(String token, DataAPIClientOptions options)
      Constructor with options and not token override.
      Parameters:
      token - authentication token
      options - data API client options
  • Method Details