public abstract class AbstractTableMetadata extends Object
Modifier and Type | Field and Description |
---|---|
protected VersionNumber |
cassandraVersion |
protected List<ColumnMetadata> |
clusteringColumns |
protected List<ClusteringOrder> |
clusteringOrder |
protected Map<String,ColumnMetadata> |
columns |
protected UUID |
id |
protected KeyspaceMetadata |
keyspace |
protected String |
name |
protected TableOptionsMetadata |
options |
protected List<ColumnMetadata> |
partitionKey |
Modifier | Constructor and Description |
---|---|
protected |
AbstractTableMetadata(KeyspaceMetadata keyspace,
String name,
UUID id,
List<ColumnMetadata> partitionKey,
List<ColumnMetadata> clusteringColumns,
Map<String,ColumnMetadata> columns,
TableOptionsMetadata options,
List<ClusteringOrder> clusteringOrder,
VersionNumber cassandraVersion) |
Modifier and Type | Method and Description |
---|---|
protected StringBuilder |
appendOptions(StringBuilder sb,
boolean formatted) |
String |
asCQLQuery()
Returns a single CQL statement representing this table or materialized view.
|
protected abstract String |
asCQLQuery(boolean formatted) |
String |
exportAsString()
Returns a
String containing CQL statements representing this
table or materialized view and all of its derived resources, such as secondary indexes
or – in the case of a table – its own materialized views. |
List<ColumnMetadata> |
getClusteringColumns()
Returns the list of clustering columns for this table.
|
List<ClusteringOrder> |
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.
|
TableOptionsMetadata |
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.
|
String |
toString() |
protected final KeyspaceMetadata keyspace
protected final String name
protected final UUID id
protected final List<ColumnMetadata> partitionKey
protected final List<ColumnMetadata> clusteringColumns
protected final Map<String,ColumnMetadata> columns
protected final TableOptionsMetadata options
protected final List<ClusteringOrder> clusteringOrder
protected final VersionNumber cassandraVersion
protected AbstractTableMetadata(KeyspaceMetadata keyspace, String name, UUID id, List<ColumnMetadata> partitionKey, List<ColumnMetadata> clusteringColumns, Map<String,ColumnMetadata> columns, TableOptionsMetadata options, List<ClusteringOrder> clusteringOrder, VersionNumber cassandraVersion)
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)
).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<ClusteringOrder> 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 keys are in ascending order.public TableOptionsMetadata getOptions()
public String exportAsString()
String
containing CQL statements representing this
table or materialized view and all of its derived resources, such as secondary indexes
or – in the case of a table – its own materialized views.
In other words, this method returns the statements that would allow you to
recreate the complete schema of this table or view, along with the secondary indexes
and materialized views defined on it, if any.
Note that the returned String is formatted to be human readable (for
some definition of human readable at least).String
.asCQLQuery()
public String asCQLQuery()
CREATE TABLE
or
CREATE MATERIALIZED VIEW
statement with the options
corresponding to this table or view definition.
Note that the returned string is a single line; the returned statement
is not formatted in any way.CREATE TABLE
or CREATE MATERIALIZED VIEW
statement corresponding to this table or view.exportAsString()
protected abstract String asCQLQuery(boolean formatted)
protected StringBuilder appendOptions(StringBuilder sb, boolean formatted)
Copyright © 2012–2017. All rights reserved.