Class Command

java.lang.Object
com.datastax.astra.client.model.Command
All Implemented Interfaces:
Serializable

public class Command extends Object implements Serializable
Represent a command to be executed against the Data API.
See Also:
  • Field Details

    • name

      protected String name
      Command Name.
    • payload

      protected Document payload
      Command payload.
  • Constructor Details

    • Command

      public Command()
      Default constructor.
    • Command

      public Command(String name)
      Constructor with a name.
      Parameters:
      name - unique command name
    • Command

      public Command(String name, Document payload)
      Specialization of the command.
      Parameters:
      name - command name
      payload - command payload
  • Method Details

    • create

      public static Command create(String name)
      Create an empty command from its name.
      Parameters:
      name - unique command name
      Returns:
      instance of the command
    • withFilter

      public Command withFilter(Filter filter)
      Builder pattern, update filter.
      Parameters:
      filter - filter for the command
      Returns:
      self-reference
    • withReplacement

      public Command withReplacement(Object replacement)
      Builder pattern, update replacement document.
      Parameters:
      replacement - replacement for the command
      Returns:
      self-reference
    • withProjection

      public Command withProjection(Map<String,Object> projection)
      Builder pattern, update projection.
      Parameters:
      projection - projection for the command
      Returns:
      self-reference
    • withSort

      public Command withSort(Document sort)
      Builder pattern, update sort.
      Parameters:
      sort - sort for the command
      Returns:
      self-reference
    • withOptions

      public Command withOptions(Object options)
      Builder pattern, update options.
      Parameters:
      options - options for the command
      Returns:
      self-reference
    • withDocument

      public Command withDocument(Object document)
      Builder pattern, update document.
      Parameters:
      document - document for the command
      Returns:
      self-reference
    • withDocuments

      public <T> Command withDocuments(List<T> documents)
      Builder pattern, update documents.
      Type Parameters:
      T - working clas for documents
      Parameters:
      documents - documents for the command
      Returns:
      self-reference
    • append

      public Command append(String key, Object obj)
      Builder pattern, update documents.
      Parameters:
      key - name of the attribute
      obj - value of the attribute
      Returns:
      self-reference
    • withUpdate

      public Command withUpdate(Update update)
      Builder pattern, Update.
      Parameters:
      update - update of the command
      Returns:
      self-reference