Package com.datastax.driver.core
Class TableMetadata
- java.lang.Object
-
- com.datastax.driver.core.AbstractTableMetadata
-
- com.datastax.driver.core.TableMetadata
-
public class TableMetadata extends AbstractTableMetadata
Describes a Table.
-
-
Field Summary
-
Fields inherited from class com.datastax.driver.core.AbstractTableMetadata
cassandraVersion, clusteringColumns, clusteringOrder, columns, id, keyspace, name, options, partitionKey
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected StringasCQLQuery(boolean formatted)booleanequals(Object other)StringexportAsString()Returns aStringcontaining CQL queries representing this table and the index on it.IndexMetadatagetIndex(String name)Returns metadata on a index of this table.Collection<IndexMetadata>getIndexes()Returns all indexes based on this table.MaterializedViewMetadatagetView(String name)Returns metadata on a view of this table.Collection<MaterializedViewMetadata>getViews()Returns all views based on this table.inthashCode()-
Methods inherited from class com.datastax.driver.core.AbstractTableMetadata
appendOptions, asCQLQuery, getClusteringColumns, getClusteringOrder, getColumn, getColumns, getId, getKeyspace, getName, getOptions, getPartitionKey, getPrimaryKey, isVirtual, toString
-
-
-
-
Method Detail
-
getIndex
public IndexMetadata getIndex(String name)
Returns metadata on a index of this table.- Parameters:
name- the name of the index to retrieve (namewill be interpreted as a case-insensitive identifier unless enclosed in double-quotes, seeMetadata.quote(java.lang.String)).- Returns:
- the metadata for the
nameindex if it exists, ornullotherwise.
-
getIndexes
public Collection<IndexMetadata> getIndexes()
Returns all indexes based on this table.- Returns:
- all indexes based on this table.
-
getView
public MaterializedViewMetadata getView(String name)
Returns metadata on a view of this table.- Parameters:
name- the name of the view to retrieve (namewill be interpreted as a case-insensitive identifier unless enclosed in double-quotes, seeMetadata.quote(java.lang.String)).- Returns:
- the metadata for the
nameview if it exists, ornullotherwise.
-
getViews
public Collection<MaterializedViewMetadata> getViews()
Returns all views based on this table.- Returns:
- all views based on this table.
-
exportAsString
public String exportAsString()
Returns aStringcontaining 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 indexes and views defined on this table, if any.
Note that the returned String is formatted to be human readable (for some definition of human readable at least).
- Overrides:
exportAsStringin classAbstractTableMetadata- Returns:
- the CQL queries representing this table schema as a {code String}.
-
asCQLQuery
protected String asCQLQuery(boolean formatted)
- Specified by:
asCQLQueryin classAbstractTableMetadata
-
-