Class TableDefinition
java.lang.Object
com.datastax.astra.client.tables.definition.TableDefinition
Definition of a table.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddColumn(String columnName, TableColumnDefinition columnDefinition) Adds a column to the table definition.addColumn(String name, TableColumnTypes type) Adds a column to the table with a specific type.addColumnAscii(String name) Adds an ascii column to the table.addColumnBigInt(String name) Adds a boolean column to the table.addColumnBlob(String name) Adds a blob column to the table.addColumnBoolean(String name) Adds a boolean column to the table.addColumnInt(String name) Adds an integer column to the table.addColumnList(String name, TableColumnTypes valueType) Adds a list column to the table.addColumnListUserDefinedType(String name, String udtName) Adds a list column to the table.addColumnMap(String name, TableColumnTypes keyType, TableColumnTypes valueType) Adds a map column to the table.addColumnMapUserDefinedType(String name, String udtName, TableColumnTypes keyType) Adds a list column to the table.addColumnSet(String name, TableColumnTypes valueType) Adds a set column to the table.addColumnSetUserDefinedType(String name, String udtName) Adds a list column to the table.addColumnText(String name) Adds a text column to the table.addColumnTimestamp(String name) Adds a timestamp column to the table.addColumnUserDefinedType(String name, String udtName) Adds a user defined type (udt) column.addColumnUuid(String name) Adds a UUID column to the table.addColumnVector(String name, TableColumnDefinitionVector colDefVector) Adds a vector column to the table.addPartitionBy(String partitionKey) Adds a partition key to the table's primary key.addPartitionSort(Sort column) Adds a sort column to the table's primary key.clusteringColumns(Sort... clusteringColumns) Sets the clustering columns for the table.booleanCustom equals method for comparing table definitions.inthashCode()Custom hashCode method consistent with equals.partitionKey(String... partitionKeys) Sets the partition keys for the table.toString()
-
Constructor Details
-
TableDefinition
public TableDefinition()Default constructor.
-
-
Method Details
-
addColumn
Adds a column to the table definition.- Parameters:
columnName- the name of the columncolumnDefinition- the definition of the column- Returns:
- the updated
TableDefinitioninstance - Throws:
IllegalArgumentException- ifcolumnNameis null
-
addColumn
Adds a column to the table with a specific type.- Parameters:
name- the name of the columntype- the type of the column- Returns:
- the updated
TableDefinitioninstance
-
addColumnUserDefinedType
Adds a user defined type (udt) column.- Parameters:
name- the name of the columnudtName- the type of the udt- Returns:
- the updated
TableDefinitioninstance
-
addColumnListUserDefinedType
Adds a list column to the table.- Parameters:
name- the name of the columnudtName- the name of the Udt- Returns:
- the updated
TableDefinitioninstance
-
addColumnSetUserDefinedType
Adds a list column to the table.- Parameters:
name- the name of the columnudtName- the name of the Udt- Returns:
- the updated
TableDefinitioninstance
-
addColumnMapUserDefinedType
public TableDefinition addColumnMapUserDefinedType(String name, String udtName, TableColumnTypes keyType) Adds a list column to the table.- Parameters:
name- the name of the columnudtName- the name of the UdtkeyType- the type of the keys where Udt are the values- Returns:
- the updated
TableDefinitioninstance
-
addColumnUuid
Adds a UUID column to the table.- Parameters:
name- the name of the column- Returns:
- the updated
TableDefinitioninstance
-
addColumnText
Adds a text column to the table.- Parameters:
name- the name of the column- Returns:
- the updated
TableDefinitioninstance
-
addColumnAscii
Adds an ascii column to the table.- Parameters:
name- the name of the column- Returns:
- the updated
TableDefinitioninstance
-
addColumnInt
Adds an integer column to the table.- Parameters:
name- the name of the column- Returns:
- the updated
TableDefinitioninstance
-
addColumnTimestamp
Adds a timestamp column to the table.- Parameters:
name- the name of the column- Returns:
- the updated
TableDefinitioninstance
-
addColumnBoolean
Adds a boolean column to the table.- Parameters:
name- the name of the column- Returns:
- the updated
TableDefinitioninstance
-
addColumnBigInt
Adds a boolean column to the table.- Parameters:
name- the name of the column- Returns:
- the updated
TableDefinitioninstance
-
addColumnBlob
Adds a blob column to the table.- Parameters:
name- the name of the column- Returns:
- the updated
TableDefinitioninstance
-
addColumnList
Adds a list column to the table.- Parameters:
name- the name of the columnvalueType- the type of the elements in the list- Returns:
- the updated
TableDefinitioninstance
-
addColumnSet
Adds a set column to the table.- Parameters:
name- the name of the columnvalueType- the type of the elements in the set- Returns:
- the updated
TableDefinitioninstance
-
addColumnMap
public TableDefinition addColumnMap(String name, TableColumnTypes keyType, TableColumnTypes valueType) Adds a map column to the table.- Parameters:
name- the name of the columnkeyType- the type of the keys in the mapvalueType- the type of the values in the map- Returns:
- the updated
TableDefinitioninstance
-
addColumnVector
Adds a vector column to the table.- Parameters:
name- the name of the columncolDefVector- the definition of the vector column- Returns:
- the updated
TableDefinitioninstance
-
addPartitionBy
Adds a partition key to the table's primary key.- Parameters:
partitionKey- the name of the partition key column- Returns:
- the updated
TableDefinitioninstance
-
addPartitionSort
Adds a sort column to the table's primary key.- Parameters:
column- the sort column to add- Returns:
- the updated
TableDefinitioninstance - Throws:
IllegalArgumentException- ifcolumnis null or invalid
-
partitionKey
Sets the partition keys for the table.- Parameters:
partitionKeys- the partition keys- Returns:
- the updated
TableDefinitioninstance - Throws:
IllegalArgumentException- if any of the partition keys are not valid columns
-
clusteringColumns
Sets the clustering columns for the table.- Parameters:
clusteringColumns- the clustering columns- Returns:
- the updated
TableDefinitioninstance - Throws:
IllegalArgumentException- if any of the clustering columns are not valid columns
-
toString
-
equals
Custom equals method for comparing table definitions. Compares columns and primary key structure. -
hashCode
public int hashCode()Custom hashCode method consistent with equals.
-