Class KeyspaceMetadata


  • public class KeyspaceMetadata
    extends Object
    Describes a keyspace defined in this cluster.
    • Method Detail

      • getName

        public String getName()
        Returns the name of this keyspace.
        Returns:
        the name of this CQL keyspace.
      • isDurableWrites

        public boolean isDurableWrites()
        Returns whether durable writes are set on this keyspace.
        Returns:
        true if durable writes are set on this keyspace (the default), false otherwise.
      • isVirtual

        public boolean isVirtual()
        Returns whether or not this keyspace is a virtual keyspace
        Returns:
        true if virtual keyspace default), false otherwise.
      • getReplication

        public Map<String,​String> getReplication()
        Returns the replication options for this keyspace.
        Returns:
        a map containing the replication options for this keyspace.
      • getTable

        public TableMetadata getTable​(String name)
        Returns the metadata for a table contained in this keyspace.
        Parameters:
        name - the name of table to retrieve
        Returns:
        the metadata for table name if it exists in this keyspace, null otherwise.
      • getTables

        public Collection<TableMetadata> getTables()
        Returns the tables defined in this keyspace.
        Returns:
        a collection of the metadata for the tables defined in this keyspace.
      • getMaterializedView

        public MaterializedViewMetadata getMaterializedView​(String name)
        Returns the metadata for a materialized view contained in this keyspace.
        Parameters:
        name - the name of materialized view to retrieve
        Returns:
        the metadata for materialized view name if it exists in this keyspace, null otherwise.
      • getMaterializedViews

        public Collection<MaterializedViewMetadata> getMaterializedViews()
        Returns the materialized views defined in this keyspace.
        Returns:
        a collection of the metadata for the materialized views defined in this keyspace.
      • getUserType

        public UserType getUserType​(String name)
        Returns the definition for a user defined type (UDT) in this keyspace.
        Parameters:
        name - the name of UDT definition to retrieve
        Returns:
        the definition for name if it exists in this keyspace, null otherwise.
      • getUserTypes

        public Collection<UserType> getUserTypes()
        Returns the user types defined in this keyspace.
        Returns:
        a collection of the definition for the user types defined in this keyspace.
      • getFunction

        public FunctionMetadata getFunction​(String name,
                                            Collection<DataType> argumentTypes)
        Returns the definition of a function in this keyspace.
        Parameters:
        name - the name of the function.
        argumentTypes - the types of the function's arguments.
        Returns:
        the function definition if it exists in this keyspace, null otherwise.
      • getFunction

        public FunctionMetadata getFunction​(String name,
                                            DataType... argumentTypes)
        Returns the definition of a function in this keyspace.
        Parameters:
        name - the name of the function.
        argumentTypes - the types of the function's arguments.
        Returns:
        the function definition if it exists in this keyspace, null otherwise.
      • getFunctions

        public Collection<FunctionMetadata> getFunctions()
        Returns the functions defined in this keyspace.
        Returns:
        a collection of the definition for the functions defined in this keyspace.
      • getAggregate

        public AggregateMetadata getAggregate​(String name,
                                              Collection<DataType> argumentTypes)
        Returns the definition of an aggregate in this keyspace.
        Parameters:
        name - the name of the aggregate.
        argumentTypes - the types of the aggregate's arguments.
        Returns:
        the aggregate definition if it exists in this keyspace, null otherwise.
      • getAggregate

        public AggregateMetadata getAggregate​(String name,
                                              DataType... argumentTypes)
        Returns the definition of an aggregate in this keyspace.
        Parameters:
        name - the name of the aggregate.
        argumentTypes - the types of the aggregate's arguments.
        Returns:
        the aggregate definition if it exists in this keyspace, null otherwise.
      • getAggregates

        public Collection<AggregateMetadata> getAggregates()
        Returns the aggregates defined in this keyspace.
        Returns:
        a collection of the definition for the aggregates defined in this keyspace.
      • exportAsString

        public String exportAsString()
        Returns a String containing CQL queries representing this keyspace and the user types and tables it contains.

        In other words, this method returns the queries that would allow to recreate the schema of this keyspace, along with all its user types/tables.

        Note that the returned String is formatted to be human readable (for some definition of human readable at least).

        Returns:
        the CQL queries representing this keyspace schema as a {code String}.
      • asCQLQuery

        public String asCQLQuery()
        Returns a CQL query representing this keyspace.

        This method returns a single 'CREATE KEYSPACE' query with the options corresponding to this keyspace definition.

        Returns:
        the 'CREATE KEYSPACE' query corresponding to this keyspace.
        See Also:
        exportAsString()
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • usesTablets

        public boolean usesTablets()