Class ColumnSpecification
java.lang.Object
org.springframework.data.cassandra.core.cql.keyspace.ColumnSpecification
Object to configure a CQL column specification.
Use name(String)
and type(DataType)
to set the name and type of the column, respectively. To
specify a clustered PRIMARY KEY
column, use clustered()
or clustered(Ordering)
. To specify
that the PRIMARY KEY
column is or is part of the partition key, use partitioned()
instead of
clustered()
or clustered(Ordering)
. To specify STATIC
column, use staticColumn()
.
- Author:
- Matthew T. Adams, Alex Shvid, Mark Paluch, Aleksei Zotov
-
Field Summary
Modifier and TypeFieldDescriptionstatic final Ordering
Default ordering of primary key fields; value isOrdering.ASCENDING
. -
Method Summary
Modifier and TypeMethodDescriptionIdentifies this column as a clustered key column with default ordering.Identifies this column as a clustered key column with the given ordering.Toggles the identification of this column as a clustered key column.com.datastax.oss.driver.api.core.CqlIdentifier
getName()
com.datastax.oss.driver.api.core.type.DataType
getType()
boolean
isStatic()
keyType
(PrimaryKeyType keyType) Sets the column'skeyType
.static ColumnSpecification
name
(com.datastax.oss.driver.api.core.CqlIdentifier name) Create a newColumnSpecification
for the givenname
.static ColumnSpecification
Create a newColumnSpecification
for the givenname
.Sets the column'sordering
.Identifies this column as a primary key column that is also part of a partition key.partitioned
(boolean partitioned) Toggles the identification of this column as a primary key column that also is or is part of a partition key.Identifies this column as a static column.toCql()
toCql
(StringBuilder cql) toString()
type
(com.datastax.oss.driver.api.core.type.DataType type) Sets the column's type.
-
Field Details
-
DEFAULT_ORDERING
Default ordering of primary key fields; value isOrdering.ASCENDING
.
-
-
Method Details
-
name
Create a newColumnSpecification
for the givenname
.- Parameters:
name
- must not be null or empty.- Returns:
- a new
ColumnSpecification
forname
.
-
name
Create a newColumnSpecification
for the givenname
.- Parameters:
name
- must not be null.- Returns:
- a new
ColumnSpecification
forname
.
-
type
Sets the column's type.- Returns:
- this
-
partitioned
Identifies this column as a primary key column that is also part of a partition key. Sets the column'skeyType
toPrimaryKeyType.PARTITIONED
and itsordering
to null.- Returns:
- this
-
partitioned
Toggles the identification of this column as a primary key column that also is or is part of a partition key. Setsordering
to null and, if the given boolean istrue
, then sets the column'skeyType
toPrimaryKeyType.PARTITIONED
, else sets it to null.- Returns:
- this
-
clustered
Identifies this column as a clustered key column with default ordering. Sets the column'skeyType
toPrimaryKeyType.CLUSTERED
and itsordering
toDEFAULT_ORDERING
.- Returns:
- this
-
clustered
Identifies this column as a clustered key column with the given ordering. Sets the column'skeyType
toPrimaryKeyType.CLUSTERED
and itsordering
to the givenOrdering
.- Returns:
- this
-
clustered
Toggles the identification of this column as a clustered key column. If the given boolean istrue
, then sets the column'skeyType
toPrimaryKeyType.PARTITIONED
andordering
to the givenOrdering
, else sets bothkeyType
andordering
to null.- Returns:
- this
-
keyType
Sets the column'skeyType
.- Returns:
- this
-
ordering
Sets the column'sordering
.- Returns:
- this
-
staticColumn
Identifies this column as a static column. Sets the column'sisStatic
to true.- Returns:
- this
- Since:
- 3.2
-
getName
public com.datastax.oss.driver.api.core.CqlIdentifier getName() -
getType
-
getKeyType
-
getOrdering
-
isStatic
public boolean isStatic() -
toCql
-
toCql
-
toString
-