public final class KeySet extends Object implements Serializable
If the same key is specified multiple times in the set (for example if two ranges, two keys,
or a key and a range overlap), the Cloud Spanner backend behaves as if the key were only
specified once. However, the KeySet
object itself does not perform any de-duplication.
KeySet
instances are immutable.
Modifier and Type | Class and Description |
---|---|
static class |
KeySet.Builder
Builder for
KeySet instances. |
Modifier and Type | Method and Description |
---|---|
static KeySet |
all()
Creates a key set that will retrieve all rows of a table or index.
|
boolean |
equals(Object o) |
Iterable<Key> |
getKeys()
Returns the keys in this set.
|
Iterable<KeyRange> |
getRanges()
Returns the ranges in this set.
|
int |
hashCode() |
boolean |
isAll()
Indicates whether the set will retrieve all rows in a table or index.
|
static KeySet.Builder |
newBuilder()
Returns a new builder that can be used to construct a key set.
|
static KeySet |
prefixRange(Key prefix)
Creates a key set that covers all keys where the first
prefix.size() components match
prefix exactly. |
static KeySet |
range(KeyRange range)
Creates a key set containing a single range.
|
static KeySet |
singleKey(Key key)
Creates a key set containing a single key.
|
KeySet.Builder |
toBuilder()
Returns a builder initialized with the contents of this set.
|
String |
toString() |
public static KeySet singleKey(Key key)
key
should contain exactly as many elements
as there are columns in the primary or index key with this this key set is used.public static KeySet range(KeyRange range)
KeyRange
for details of how to specify
ranges.public static KeySet prefixRange(Key prefix)
prefix.size()
components match
prefix
exactly.public static KeySet all()
public static KeySet.Builder newBuilder()
public boolean isAll()
public KeySet.Builder toBuilder()
Copyright © 2019 Google LLC. All rights reserved.