Class TableSpecification<T>
java.lang.Object
org.springframework.data.cassandra.core.cql.keyspace.TableNameSpecification
org.springframework.data.cassandra.core.cql.keyspace.TableOptionsSpecification<TableSpecification<T>>
org.springframework.data.cassandra.core.cql.keyspace.TableSpecification<T>
- All Implemented Interfaces:
TableDescriptor
- Direct Known Subclasses:
CreateTableSpecification
public class TableSpecification<T>
extends TableOptionsSpecification<TableSpecification<T>>
implements TableDescriptor
Object to support the configuration of table specifications that have columns. This class can also be used as a
standalone
TableDescriptor
, independent of CreateTableSpecification
.- Author:
- Matthew T. Adams, Alex Shvid, Mark Paluch, Aleksei Zotov
-
Constructor Summary
ModifierConstructorDescriptionprotected
TableSpecification
(com.datastax.oss.driver.api.core.CqlIdentifier name) -
Method Summary
Modifier and TypeMethodDescriptionclusteredKeyColumn
(com.datastax.oss.driver.api.core.CqlIdentifier name, com.datastax.oss.driver.api.core.type.DataType type) Adds the given primary key column to the table with ascending ordering.clusteredKeyColumn
(com.datastax.oss.driver.api.core.CqlIdentifier name, com.datastax.oss.driver.api.core.type.DataType type, Optional<Ordering> ordering) Adds the given primary key column to the table with ascending ordering.clusteredKeyColumn
(com.datastax.oss.driver.api.core.CqlIdentifier name, com.datastax.oss.driver.api.core.type.DataType type, Ordering ordering) Adds the given primary key column to the table with ascending ordering.clusteredKeyColumn
(String name, com.datastax.oss.driver.api.core.type.DataType type) Adds the given primary key column to the table with ascending ordering.clusteredKeyColumn
(String name, com.datastax.oss.driver.api.core.type.DataType type, Ordering ordering) Adds the given primary key column to the table with ascending ordering.column
(com.datastax.oss.driver.api.core.CqlIdentifier name, com.datastax.oss.driver.api.core.type.DataType type) Adds the given non-key column to the table.protected T
column
(com.datastax.oss.driver.api.core.CqlIdentifier name, com.datastax.oss.driver.api.core.type.DataType type, Optional<PrimaryKeyType> optionalKeyType, Optional<Ordering> optionalOrdering, boolean isStatic) Adds the given non-key column to the table.protected T
column
(String name, com.datastax.oss.driver.api.core.type.DataType type, PrimaryKeyType keyType) Adds the given info as a new column to the table.protected T
column
(String name, com.datastax.oss.driver.api.core.type.DataType type, PrimaryKeyType keyType, Optional<Ordering> ordering) Adds the given info as a new column to the table.protected T
column
(String name, com.datastax.oss.driver.api.core.type.DataType type, PrimaryKeyType keyType, Ordering ordering) Adds the given info as a new column to the table.Returns an unmodifiable list of all primary key columns that are not also partition key columns.Returns an unmodifiable list of all columns.Returns an unmodifiable list of all non-key columns.Returns an unmodifiable list of all partition key columns.Returns an unmodifiable list of all primary key columns that are not also partition key columns.Returns an unmodifiable list of static columns.partitionKeyColumn
(com.datastax.oss.driver.api.core.CqlIdentifier name, com.datastax.oss.driver.api.core.type.DataType type) Adds the given partition key column to the table.partitionKeyColumn
(String name, com.datastax.oss.driver.api.core.type.DataType type) Adds the given partition key column to the table.staticColumn
(com.datastax.oss.driver.api.core.CqlIdentifier name, com.datastax.oss.driver.api.core.type.DataType type) Adds the given static column to the table.staticColumn
(String name, com.datastax.oss.driver.api.core.type.DataType type) Adds the given static column to the table.Methods inherited from class org.springframework.data.cassandra.core.cql.keyspace.TableOptionsSpecification
getOptions, with, with, with
Methods inherited from class org.springframework.data.cassandra.core.cql.keyspace.TableNameSpecification
getName
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.springframework.data.cassandra.core.cql.keyspace.TableDescriptor
getName, getOptions
-
Constructor Details
-
TableSpecification
protected TableSpecification(com.datastax.oss.driver.api.core.CqlIdentifier name)
-
-
Method Details
-
column
Adds the given non-key column to the table. Must be specified after all primary key columns.- Parameters:
name
- The column name; must be a valid unquoted or quoted identifier without the surrounding double quotes, must not be null.type
- The data type of the column, must not be null.
-
column
public T column(com.datastax.oss.driver.api.core.CqlIdentifier name, com.datastax.oss.driver.api.core.type.DataType type) Adds the given non-key column to the table. Must be specified after all primary key columns.- Parameters:
name
- The column name; must be a valid unquoted or quoted identifier without the surrounding double quotes, must not be null.type
- The data type of the column, must not be null.
-
staticColumn
Adds the given static column to the table. Must be specified after all primary key columns.- Parameters:
name
- The column name; must be a valid unquoted or quoted identifier without the surrounding double quotes, must not be null.type
- The data type of the column, must not be null.- Since:
- 3.2
-
staticColumn
public T staticColumn(com.datastax.oss.driver.api.core.CqlIdentifier name, com.datastax.oss.driver.api.core.type.DataType type) Adds the given static column to the table. Must be specified after all primary key columns.- Parameters:
name
- The column name; must be a valid unquoted or quoted identifier without the surrounding double quotes, must not be null.type
- The data type of the column, must not be null.- Since:
- 3.2
-
partitionKeyColumn
Adds the given partition key column to the table. Must be specified before any other columns.- Parameters:
name
- The column name; must be a valid unquoted or quoted identifier without the surrounding double quotes, must not be null.type
- The data type of the column, must not be null.- Returns:
- this
-
partitionKeyColumn
public T partitionKeyColumn(com.datastax.oss.driver.api.core.CqlIdentifier name, com.datastax.oss.driver.api.core.type.DataType type) Adds the given partition key column to the table. Must be specified before any other columns.- Parameters:
name
- The column name; must be a valid unquoted or quoted identifier without the surrounding double quotes, must not be null.type
- The data type of the column, must not be null.- Returns:
- this
-
clusteredKeyColumn
Adds the given primary key column to the table with ascending ordering. Must be specified after all partition key columns and before any non-key columns.- Parameters:
name
- The column name; must be a valid unquoted or quoted identifier without the surrounding double quotes, must not be null.type
- The data type of the column, must not be null.- Returns:
- this
-
clusteredKeyColumn
public T clusteredKeyColumn(String name, com.datastax.oss.driver.api.core.type.DataType type, Ordering ordering) Adds the given primary key column to the table with ascending ordering. Must be specified after all partition key columns and before any non-key columns.- Parameters:
name
- The column name; must be a valid unquoted or quoted identifier without the surrounding double quotes, must not be null.type
- The data type of the column, must not be null.ordering
- The data type of the column, must not be null.- Returns:
- this
- Since:
- 2.1
-
clusteredKeyColumn
public T clusteredKeyColumn(com.datastax.oss.driver.api.core.CqlIdentifier name, com.datastax.oss.driver.api.core.type.DataType type) Adds the given primary key column to the table with ascending ordering. Must be specified after all partition key columns and before any non-key columns.- Parameters:
name
- The column name; must be a valid unquoted or quoted identifier without the surrounding double quotes, must not be null.type
- The data type of the column, must not be null.- Returns:
- this
-
clusteredKeyColumn
public T clusteredKeyColumn(com.datastax.oss.driver.api.core.CqlIdentifier name, com.datastax.oss.driver.api.core.type.DataType type, Ordering ordering) Adds the given primary key column to the table with ascending ordering. Must be specified after all partition key columns and before any non-key columns.- Parameters:
name
- The column name; must be a valid unquoted or quoted identifier without the surrounding double quotes, must not be null.type
- The data type of the column, must not be null.ordering
- The data type of the column, must not be null.- Returns:
- this
-
clusteredKeyColumn
public T clusteredKeyColumn(com.datastax.oss.driver.api.core.CqlIdentifier name, com.datastax.oss.driver.api.core.type.DataType type, Optional<Ordering> ordering) Adds the given primary key column to the table with ascending ordering. Must be specified after all partition key columns and before any non-key columns.- Parameters:
name
- The column name; must be a valid unquoted or quoted identifier without the surrounding double quotes, must not be null.type
- The data type of the column, must not be null.ordering
- The data type of the column, must not be null.- Returns:
- this
-
column
protected T column(String name, com.datastax.oss.driver.api.core.type.DataType type, PrimaryKeyType keyType) Adds the given info as a new column to the table. Partition key columns must precede primary key columns, which must precede non-key columns.- Parameters:
name
- The column name; must be a valid unquoted or quoted identifier without the surrounding double quotes, must not be null.type
- The data type of the column, must not be null.keyType
- Indicates key type. Null means that the column is not a key column, must not be null.- Returns:
- this
-
column
protected T column(String name, com.datastax.oss.driver.api.core.type.DataType type, PrimaryKeyType keyType, Ordering ordering) Adds the given info as a new column to the table. Partition key columns must precede primary key columns, which must precede non-key columns.- Parameters:
name
- The column name; must be a valid unquoted or quoted identifier without the surrounding double quotes, must not be null.type
- The data type of the column, must not be null.keyType
- Indicates key type, must not be null.ordering
- If the givenPrimaryKeyType
isPrimaryKeyType.CLUSTERED
, then the given ordering is used, else ignored, must not be null.- Returns:
- this
-
column
protected T column(String name, com.datastax.oss.driver.api.core.type.DataType type, PrimaryKeyType keyType, Optional<Ordering> ordering) Adds the given info as a new column to the table. Partition key columns must precede primary key columns, which must precede non-key columns.- Parameters:
name
- The column name; must be a valid unquoted or quoted identifier without the surrounding double quotes, must not be null.type
- The data type of the column, must not be null.keyType
- Indicates key type, must not be null.ordering
- If the givenPrimaryKeyType
isPrimaryKeyType.CLUSTERED
, then the given ordering is used, else ignored, must not be null.- Returns:
- this
-
column
protected T column(com.datastax.oss.driver.api.core.CqlIdentifier name, com.datastax.oss.driver.api.core.type.DataType type, Optional<PrimaryKeyType> optionalKeyType, Optional<Ordering> optionalOrdering, boolean isStatic) -
getColumns
Returns an unmodifiable list of all columns.- Specified by:
getColumns
in interfaceTableDescriptor
-
getPartitionKeyColumns
Returns an unmodifiable list of all partition key columns.- Specified by:
getPartitionKeyColumns
in interfaceTableDescriptor
-
getClusteredKeyColumns
Returns an unmodifiable list of all primary key columns that are not also partition key columns.- Specified by:
getClusteredKeyColumns
in interfaceTableDescriptor
-
getPrimaryKeyColumns
Returns an unmodifiable list of all primary key columns that are not also partition key columns.- Specified by:
getPrimaryKeyColumns
in interfaceTableDescriptor
-
getNonKeyColumns
Returns an unmodifiable list of all non-key columns.- Specified by:
getNonKeyColumns
in interfaceTableDescriptor
-
getStaticColumns
Returns an unmodifiable list of static columns.- Specified by:
getStaticColumns
in interfaceTableDescriptor
-