Package org.apache.cassandra.schema
Class Keyspaces
- java.lang.Object
-
- org.apache.cassandra.schema.Keyspaces
-
- All Implemented Interfaces:
java.lang.Iterable<KeyspaceMetadata>
public final class Keyspaces extends java.lang.Object implements java.lang.Iterable<KeyspaceMetadata>
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classKeyspaces.Builderstatic classKeyspaces.KeyspacesDiff
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Keyspaces.Builderbuilder()booleancontainsKeyspace(java.lang.String name)static Keyspaces.KeyspacesDiffdiff(Keyspaces before, Keyspaces after)booleanequals(java.lang.Object o)Keyspacesfilter(java.util.function.Predicate<KeyspaceMetadata> predicate)java.util.Optional<KeyspaceMetadata>get(java.lang.String name)Get the keyspace with the specified nameKeyspaceMetadatagetNullable(java.lang.String name)TableMetadatagetTableOrViewNullable(TableId id)inthashCode()booleanisEmpty()java.util.Iterator<KeyspaceMetadata>iterator()com.google.common.collect.ImmutableSet<java.lang.String>names()static Keyspacesnone()static Keyspacesof(KeyspaceMetadata... keyspaces)intsize()java.util.stream.Stream<KeyspaceMetadata>stream()java.lang.StringtoString()voidvalidate()KeyspaceswithAddedOrReplaced(KeyspaceMetadata keyspace)KeyspaceswithAddedOrReplaced(Keyspaces keyspaces)CallswithAddedOrReplaced(KeyspaceMetadata)on all the keyspaces of the providedKeyspaces.KeyspaceswithAddedOrUpdated(KeyspaceMetadata keyspace)Keyspaceswithout(java.lang.String name)Creates a Keyspaces instance with the keyspace with the provided name removedKeyspaceswithout(java.util.Collection<java.lang.String> names)
-
-
-
Method Detail
-
builder
public static Keyspaces.Builder builder()
-
none
public static Keyspaces none()
-
of
public static Keyspaces of(KeyspaceMetadata... keyspaces)
-
iterator
public java.util.Iterator<KeyspaceMetadata> iterator()
- Specified by:
iteratorin interfacejava.lang.Iterable<KeyspaceMetadata>
-
stream
public java.util.stream.Stream<KeyspaceMetadata> stream()
-
names
public com.google.common.collect.ImmutableSet<java.lang.String> names()
-
get
public java.util.Optional<KeyspaceMetadata> get(java.lang.String name)
Get the keyspace with the specified name- Parameters:
name- a non-qualified keyspace name- Returns:
- an empty
Optionalif the table name is not found; a non-empty optional ofKeyspaceMetadataotherwise
-
getNullable
@Nullable public KeyspaceMetadata getNullable(java.lang.String name)
-
containsKeyspace
public boolean containsKeyspace(java.lang.String name)
-
getTableOrViewNullable
@Nullable public TableMetadata getTableOrViewNullable(TableId id)
-
isEmpty
public boolean isEmpty()
-
filter
public Keyspaces filter(java.util.function.Predicate<KeyspaceMetadata> predicate)
-
without
public Keyspaces without(java.lang.String name)
Creates a Keyspaces instance with the keyspace with the provided name removed
-
without
public Keyspaces without(java.util.Collection<java.lang.String> names)
-
withAddedOrUpdated
public Keyspaces withAddedOrUpdated(KeyspaceMetadata keyspace)
-
withAddedOrReplaced
public Keyspaces withAddedOrReplaced(KeyspaceMetadata keyspace)
Returns a newKeyspacesequivalent to this one, but with the provided keyspace metadata either added (if thisKeyspacesdoes not have that keyspace), or replaced by the provided definition.Note that if this contains the provided keyspace, its pre-existing definition is discarded and completely replaced with the newly provided one. See
withAddedOrUpdated(KeyspaceMetadata)if you wish the provided definition to be "merged" with the existing one instead.- Parameters:
keyspace- the keyspace metadata to add, or replace the existing definition with.- Returns:
- the newly created object.
-
withAddedOrReplaced
public Keyspaces withAddedOrReplaced(Keyspaces keyspaces)
CallswithAddedOrReplaced(KeyspaceMetadata)on all the keyspaces of the providedKeyspaces.- Parameters:
keyspaces- the keyspaces to add, or replace if existing.- Returns:
- the newly created object.
-
validate
public void validate()
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
size
public int size()
-
diff
public static Keyspaces.KeyspacesDiff diff(Keyspaces before, Keyspaces after)
-
-