Class Indexes

java.lang.Object
org.apache.cassandra.schema.Indexes
All Implemented Interfaces:
Iterable<IndexMetadata>

public final class Indexes extends Object implements Iterable<IndexMetadata>
For backwards compatibility, in the first instance an IndexMetadata must have TargetType.COLUMN and its Set of target columns must contain only a single ColumnIdentifier. Hence, this is what is enforced by the public factory methods on IndexMetadata. These constraints, along with the internal datastructures here will be relaxed as support is added for multiple target columns per-index and for indexes with TargetType.ROW
  • Method Details

    • builder

      public static Indexes.Builder builder()
    • none

      public static Indexes none()
    • of

      public static Indexes of(IndexMetadata... indexes)
    • of

      public static Indexes of(Iterable<IndexMetadata> indexes)
    • iterator

      public Iterator<IndexMetadata> iterator()
      Specified by:
      iterator in interface Iterable<IndexMetadata>
    • stream

      public Stream<IndexMetadata> stream()
    • size

      public int size()
    • isEmpty

      public boolean isEmpty()
    • get

      public Optional<IndexMetadata> get(String name)
      Get the index with the specified name
      Parameters:
      name - a non-qualified index name
      Returns:
      an empty Optional if the named index is not found; a non-empty optional of IndexMetadata otherwise
    • has

      public boolean has(String name)
      Answer true if contains an index with the specified name.
      Parameters:
      name - a non-qualified index name.
      Returns:
      true if the named index is found; false otherwise
    • get

      public Optional<IndexMetadata> get(UUID id)
      Get the index with the specified id
      Parameters:
      id - a UUID which identifies an index
      Returns:
      an empty Optional if no index with the specified id is found; a non-empty optional of IndexMetadata otherwise
    • has

      public boolean has(UUID id)
      Answer true if contains an index with the specified id.
      Parameters:
      id - a UUID which identifies an index.
      Returns:
      true if an index with the specified id is found; false otherwise
    • with

      public Indexes with(IndexMetadata index)
      Create a SecondaryIndexes instance with the provided index added
    • without

      public Indexes without(String name)
      Creates a SecondaryIndexes instance with the index with the provided name removed
    • replace

      public Indexes replace(IndexMetadata index)
      Creates a SecondaryIndexes instance which contains an updated index definition
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • validate

      public void validate(TableMetadata table)
    • hashCode

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

      public String toString()
      Overrides:
      toString in class Object