Class TableOptionsSpecification<T extends TableOptionsSpecification<T>>

Type Parameters:
T - The subtype of the TableOptionsSpecification.
Direct Known Subclasses:
AlterTableSpecification, TableSpecification

public abstract class TableOptionsSpecification<T extends TableOptionsSpecification<T>> extends TableNameSpecification
Abstract builder class to support the construction of table specifications that have table options, that is, those options normally specified by WITH ... AND ....

It is important to note that although this class depends on TableOption for convenient and typesafe use, it ultimately stores its options in a Map for flexibility. This means that with(TableOption) and with(TableOption, Object) delegate to with(String, Object, boolean, boolean). This design allows the API to support new Cassandra options as they are introduced without having to update the code immediately.

Matthew T. Adams, Mark Paluch
  • Constructor Details

    • TableOptionsSpecification

      protected TableOptionsSpecification(com.datastax.oss.driver.api.core.CqlIdentifier name)
  • Method Details

    • with

      public T with(TableOption option)
      Convenience method that calls with(option, null).
    • with

      public T with(TableOption option, Object value)
      Sets the given table option. This is a convenience method that calls with(String, Object, boolean, boolean) appropriately from the given TableOption and value for that option.
      option - The option to set.
      value - The value of the option. Must be type-compatible with the TableOption.
      See Also:
    • with

      public T with(String name, @Nullable Object value, boolean escape, boolean quote)
      Adds the given option by name to this table's options.

      Options that have null values are considered single string options where the name of the option is the string to be used. Otherwise, the result of Object.toString() is considered to be the value of the option with the given name. The value, after conversion to string, may have embedded single quotes escaped according to parameter escape and may be single-quoted according to parameter quote.

      name - The name of the option
      value - The value of the option. If null, the value is ignored and the option is considered to be composed of only the name, otherwise the value's Object.toString() value is used.
      escape - Whether to escape the value via CqlStringUtils.escapeSingle(Object). Ignored if given value is an instance of a Map.
      quote - Whether to quote the value via CqlStringUtils.singleQuote(Object). Ignored if given value is an instance of a Map.
    • getOptions

      public Map<String,Object> getOptions()