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 class
Keyspaces.Builder
static class
Keyspaces.KeyspacesDiff
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Keyspaces.Builder
builder()
boolean
containsKeyspace(java.lang.String name)
static Keyspaces.KeyspacesDiff
diff(Keyspaces before, Keyspaces after)
boolean
equals(java.lang.Object o)
Keyspaces
filter(java.util.function.Predicate<KeyspaceMetadata> predicate)
java.util.Optional<KeyspaceMetadata>
get(java.lang.String name)
Get the keyspace with the specified nameKeyspaceMetadata
getNullable(java.lang.String name)
TableMetadata
getTableOrViewNullable(TableId id)
int
hashCode()
boolean
isEmpty()
java.util.Iterator<KeyspaceMetadata>
iterator()
com.google.common.collect.ImmutableSet<java.lang.String>
names()
static Keyspaces
none()
static Keyspaces
of(KeyspaceMetadata... keyspaces)
int
size()
java.util.stream.Stream<KeyspaceMetadata>
stream()
java.lang.String
toString()
void
validate()
Keyspaces
withAddedOrReplaced(KeyspaceMetadata keyspace)
Keyspaces
withAddedOrReplaced(Keyspaces keyspaces)
CallswithAddedOrReplaced(KeyspaceMetadata)
on all the keyspaces of the providedKeyspaces
.Keyspaces
withAddedOrUpdated(KeyspaceMetadata keyspace)
Keyspaces
without(java.lang.String name)
Creates a Keyspaces instance with the keyspace with the provided name removedKeyspaces
without(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:
iterator
in 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
Optional
if the table name is not found; a non-empty optional ofKeyspaceMetadata
otherwise
-
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 newKeyspaces
equivalent to this one, but with the provided keyspace metadata either added (if thisKeyspaces
does 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:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
size
public int size()
-
diff
public static Keyspaces.KeyspacesDiff diff(Keyspaces before, Keyspaces after)
-
-