Class CreateTableSpecification
- All Implemented Interfaces:
CqlSpecification, TableDescriptor
CREATE TABLE specification.- Author:
- Matthew T. Adams, Mark Paluch
-
Method Summary
Modifier and TypeMethodDescriptionstatic CreateTableSpecificationcreateTable(@Nullable com.datastax.oss.driver.api.core.CqlIdentifier keyspace, com.datastax.oss.driver.api.core.CqlIdentifier tableName) Entry point into theCreateTableSpecification's fluent API giventableNameto create a table.static CreateTableSpecificationcreateTable(com.datastax.oss.driver.api.core.CqlIdentifier tableName) Entry point into theCreateTableSpecification's fluent API giventableNameto create a table.static CreateTableSpecificationcreateTable(String tableName) Entry point into theCreateTableSpecification's fluent API giventableNameto create a table.booleanCauses the inclusion of anIF NOT EXISTSclause.ifNotExists(boolean ifNotExists) Toggles the inclusion of anIF NOT EXISTSclause.Adds the given option by name to this table's options.Adds the given option by name to this table's options.with(TableOption option) Convenience method that calls#with(TableOption, null)or#with(TableOption, true)if the option requires abooleanvalue.with(TableOption option, Object value) Sets the given table option.Methods inherited from class TableSpecification
clusteredKeyColumn, clusteredKeyColumn, clusteredKeyColumn, clusteredKeyColumn, clusteredKeyColumn, column, column, column, column, column, column, getClusteredKeyColumns, getColumns, getNonKeyColumns, getPartitionKeyColumns, getPrimaryKeyColumns, getStaticColumns, partitionKeyColumn, partitionKeyColumn, staticColumn, staticColumnMethods inherited from class TableOptionsSpecification
getOptionsMethods inherited from class TableNameSpecification
getKeyspace, getNameMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface TableDescriptor
getName, getOptions
-
Method Details
-
createTable
Entry point into theCreateTableSpecification's fluent API giventableNameto create a table. Convenient if imported statically.- Parameters:
tableName- must not be null or empty.- Returns:
- a new
CreateTableSpecification.
-
createTable
public static CreateTableSpecification createTable(com.datastax.oss.driver.api.core.CqlIdentifier tableName) Entry point into theCreateTableSpecification's fluent API giventableNameto create a table. Convenient if imported statically.- Parameters:
tableName- must not be null.- Returns:
- a new
CreateTableSpecification.
-
createTable
public static CreateTableSpecification createTable(@Nullable com.datastax.oss.driver.api.core.CqlIdentifier keyspace, com.datastax.oss.driver.api.core.CqlIdentifier tableName) Entry point into theCreateTableSpecification's fluent API giventableNameto create a table. Convenient if imported statically. Uses the default keyspace ifkeyspaceis null; otherwise, of thekeyspaceis not null, then the table name is prefixed withkeyspace.- Parameters:
keyspace- can be null.tableName- must not be null.- Returns:
- a new
CreateTableSpecification. - Since:
- 4.4
-
ifNotExists
Causes the inclusion of anIF NOT EXISTSclause.- Returns:
- this
-
ifNotExists
Toggles the inclusion of anIF NOT EXISTSclause.- Returns:
- this
-
getIfNotExists
public boolean getIfNotExists() -
with
Description copied from class:TableOptionsSpecificationConvenience method that calls#with(TableOption, null)or#with(TableOption, true)if the option requires abooleanvalue.- Overrides:
within classTableOptionsSpecification<TableSpecification<CreateTableSpecification>>- Returns:
- this
-
with
Description copied from class:TableOptionsSpecificationSets the given table option. This is a convenience method that callsTableOptionsSpecification.with(String, Object, boolean, boolean)appropriately from the givenTableOptionand value for that option.- Overrides:
within classTableOptionsSpecification<TableSpecification<CreateTableSpecification>>- Parameters:
option- the option to set.value- the value of the option. Must be type-compatible with theTableOption.- Returns:
- this
- See Also:
-
with
Description copied from class:TableOptionsSpecificationAdds 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. Values that require escaping or quoting should be handled by the specification must be either quoted and escaped already or provided throughTableOptionsSpecification.with(String, Object, boolean, boolean).- Overrides:
within classTableOptionsSpecification<TableSpecification<CreateTableSpecification>>- Parameters:
name- the name of the optionvalue- 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'sObject.toString()value is used.- Returns:
- this
-
with
public CreateTableSpecification with(String name, @Nullable Object value, boolean escape, boolean quote) Description copied from class:TableOptionsSpecificationAdds 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 parameterescapeand may be single-quoted according to parameterquote.- Overrides:
within classTableOptionsSpecification<TableSpecification<CreateTableSpecification>>- Parameters:
name- the name of the optionvalue- 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'sObject.toString()value is used.escape- whether to escape the value viaCqlStringUtils.escapeSingle(Object). Ignored if given value is an instance of aMap.quote- whether to quote the value viaCqlStringUtils.singleQuote(Object). Ignored if given value is an instance of aMap.- Returns:
- this
-