public class TableMetadata extends Object
Modifier and Type | Class and Description |
---|---|
static class |
TableMetadata.Options |
static class |
TableMetadata.Order
Clustering orders.
|
Modifier and Type | Method and Description |
---|---|
String |
asCQLQuery()
Returns a CQL query representing this table.
|
boolean |
equals(Object o) |
String |
exportAsString()
Returns a
String containing CQL queries representing this
table and the index on it. |
List<ColumnMetadata> |
getClusteringColumns()
Returns the list of clustering columns for this table.
|
List<TableMetadata.Order> |
getClusteringOrder()
Returns the clustering order for this table.
|
ColumnMetadata |
getColumn(String name)
Returns metadata on a column of this table.
|
List<ColumnMetadata> |
getColumns()
Returns a list containing all the columns of this table.
|
UUID |
getId()
Returns the unique id of this table.
|
KeyspaceMetadata |
getKeyspace()
Returns the keyspace this table belong to.
|
String |
getName()
Returns the name of this table.
|
TableMetadata.Options |
getOptions()
Returns the options for this table.
|
List<ColumnMetadata> |
getPartitionKey()
Returns the list of columns composing the partition key for this table.
|
List<ColumnMetadata> |
getPrimaryKey()
Returns the list of columns composing the primary key for this table.
|
int |
hashCode() |
String |
toString() |
public String getName()
public UUID getId()
null
for earlier versions.public KeyspaceMetadata getKeyspace()
public ColumnMetadata getColumn(String name)
name
- the name of the column to retrieve (name
will be
interpreted as a case-insensitive identifier unless enclosed in double-quotes,
see Metadata.quote(java.lang.String)
).name
column if it exists, or
null
otherwise.public List<ColumnMetadata> getColumns()
SELECT * FROM thisTable
:
the first column is the partition key, next are the clustering
columns in their defined order, and then the rest of the
columns follow in alphabetic order.public List<ColumnMetadata> getPrimaryKey()
public List<ColumnMetadata> getPartitionKey()
public List<ColumnMetadata> getClusteringColumns()
public List<TableMetadata.Order> getClusteringOrder()
i
th element of the result correspond to the order (ascending or
descending) of the i
th clustering column (see
getClusteringColumns()
). Note that a table defined without any
particular clustering order is equivalent to one for which all the
clustering key are in ascending order.public TableMetadata.Options getOptions()
public String exportAsString()
String
containing CQL queries representing this
table and the index on it.
In other words, this method returns the queries that would allow you to
recreate the schema of this table, along with the index defined on
columns of this table.
Note that the returned String is formatted to be human readable (for
some definition of human readable at least).public String asCQLQuery()
exportAsString()