Package org.apache.cassandra.schema
Class Indexes
- java.lang.Object
-
- org.apache.cassandra.schema.Indexes
-
- All Implemented Interfaces:
java.lang.Iterable<IndexMetadata>
public final class Indexes extends java.lang.Object implements java.lang.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
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classIndexes.Builder
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Indexes.Builderbuilder()booleanequals(java.lang.Object o)java.util.Optional<IndexMetadata>get(java.lang.String name)Get the index with the specified namejava.util.Optional<IndexMetadata>get(java.util.UUID id)Get the index with the specified idbooleanhas(java.lang.String name)Answer true if contains an index with the specified name.booleanhas(java.util.UUID id)Answer true if contains an index with the specified id.inthashCode()booleanisEmpty()java.util.Iterator<IndexMetadata>iterator()static Indexesnone()static Indexesof(java.lang.Iterable<IndexMetadata> indexes)static Indexesof(IndexMetadata... indexes)Indexesreplace(IndexMetadata index)Creates a SecondaryIndexes instance which contains an updated index definitionintsize()java.util.stream.Stream<IndexMetadata>stream()java.lang.StringtoString()voidvalidate(TableMetadata table)Indexeswith(IndexMetadata index)Create a SecondaryIndexes instance with the provided index addedIndexeswithout(java.lang.String name)Creates a SecondaryIndexes instance with the index with the provided name removed
-
-
-
Method Detail
-
builder
public static Indexes.Builder builder()
-
none
public static Indexes none()
-
of
public static Indexes of(IndexMetadata... indexes)
-
of
public static Indexes of(java.lang.Iterable<IndexMetadata> indexes)
-
iterator
public java.util.Iterator<IndexMetadata> iterator()
- Specified by:
iteratorin interfacejava.lang.Iterable<IndexMetadata>
-
stream
public java.util.stream.Stream<IndexMetadata> stream()
-
size
public int size()
-
isEmpty
public boolean isEmpty()
-
get
public java.util.Optional<IndexMetadata> get(java.lang.String name)
Get the index with the specified name- Parameters:
name- a non-qualified index name- Returns:
- an empty
Optionalif the named index is not found; a non-empty optional ofIndexMetadataotherwise
-
has
public boolean has(java.lang.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 java.util.Optional<IndexMetadata> get(java.util.UUID id)
Get the index with the specified id- Parameters:
id- a UUID which identifies an index- Returns:
- an empty
Optionalif no index with the specified id is found; a non-empty optional ofIndexMetadataotherwise
-
has
public boolean has(java.util.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(java.lang.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(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
validate
public void validate(TableMetadata table)
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-