Class CommandOptions<T extends CommandOptions<T>>

java.lang.Object
com.datastax.astra.client.model.CommandOptions<T>
Type Parameters:
T - the sub-class implementing the command options
Direct Known Subclasses:
BulkWriteOptions, CountDocumentsOptions, DeleteManyOptions, DeleteOneOptions, EstimatedCountDocumentsOptions, FindOneAndDeleteOptions, FindOneAndReplaceOptions, FindOneAndUpdateOptions, FindOneOptions, FindOptions, InsertManyOptions, InsertOneOptions, ReplaceOneOptions, UpdateManyOptions, UpdateOneOptions

public class CommandOptions<T extends CommandOptions<T>> extends Object
Options that will be provided to all commands for this collection.
  • Field Details

    • observers

      protected Map<String,CommandObserver> observers
      List of observers to notify.
    • token

      protected String token
      Token to use for authentication.
    • httpClientOptions

      protected HttpClientOptions httpClientOptions
      Will be used to create a client
    • embeddingAuthProvider

      protected EmbeddingHeadersProvider embeddingAuthProvider
      Embedding auth provider
  • Constructor Details

    • CommandOptions

      public CommandOptions()
      Default Constructor.
  • Method Details

    • token

      public T token(String token)
      Provide the token.
      Parameters:
      token - authentication token
      Returns:
      service key
    • httpClientOptions

      public T httpClientOptions(HttpClientOptions options)
      Provide the token.
      Parameters:
      options - options to initialize the http client
      Returns:
      service key
    • embeddingAuthProvider

      public T embeddingAuthProvider(EmbeddingHeadersProvider embeddingAuthProvider)
      Provide the embedding service API key.
      Parameters:
      embeddingAuthProvider - authentication provider
      Returns:
      service key
    • embeddingAPIKey

      @Deprecated public T embeddingAPIKey(String embeddingServiceApiKey)
      Deprecated.
      Provide the embedding service API key.
      Parameters:
      embeddingServiceApiKey - embedding service key
      Returns:
      service key
    • registerObserver

      public T registerObserver(String name, CommandObserver observer)
      Allow to register a listener for the command.
      Parameters:
      name - name of the observer
      observer - observer to register
      Returns:
      instance of the command options
    • registerObserver

      public T registerObserver(CommandObserver observer)
      Register an observer with its className.
      Parameters:
      observer - command observer
      Returns:
      instance of the command options
    • unregisterObserver

      public T unregisterObserver(String name)
      Remove a listener from the command.
      Parameters:
      name - name of the observer
      Returns:
      instance of the command options
    • unregisterObserver

      public T unregisterObserver(Class<CommandObserver> observer)
      Remove an observer by its class.
      Parameters:
      observer - observer to remove
      Returns:
      instance of the command options
    • getEmbeddingAuthProvider

      public Optional<EmbeddingHeadersProvider> getEmbeddingAuthProvider()
      Return the @EmbeddingAuthProvider if present in the configuration.
      Returns:
      value of token
    • getToken

      public Optional<String> getToken()
      Gets token
      Returns:
      value of token
    • getHttpClientOptions

      public Optional<HttpClientOptions> getHttpClientOptions()
      Gets httpClientOptions
      Returns:
      value of httpClientOptions