Package com.google.cloud.spanner
Class KeySet
- java.lang.Object
-
- com.google.cloud.spanner.KeySet
-
- All Implemented Interfaces:
Serializable
public final class KeySet extends Object implements Serializable
Defines a collection of Cloud Spanner keys and/or key ranges. All the keys are expected to be in the same table or index. The keys need not be sorted in any particular way.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
KeySetobject itself does not perform any de-duplication.KeySetinstances are immutable.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classKeySet.BuilderBuilder forKeySetinstances.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static KeySetall()Creates a key set that will retrieve all rows of a table or index.booleanequals(Object o)Iterable<Key>getKeys()Returns the keys in this set.Iterable<KeyRange>getRanges()Returns the ranges in this set.inthashCode()booleanisAll()Indicates whether the set will retrieve all rows in a table or index.static KeySet.BuildernewBuilder()Returns a new builder that can be used to construct a key set.static KeySetprefixRange(Key prefix)Creates a key set that covers all keys where the firstprefix.size()components matchprefixexactly.static KeySetrange(KeyRange range)Creates a key set containing a single range.static KeySetsingleKey(Key key)Creates a key set containing a single key.KeySet.BuildertoBuilder()Returns a builder initialized with the contents of this set.StringtoString()
-
-
-
Method Detail
-
singleKey
public static KeySet singleKey(Key key)
Creates a key set containing a single key.keyshould contain exactly as many elements as there are columns in the primary or index key with this this key set is used.
-
range
public static KeySet range(KeyRange range)
Creates a key set containing a single range. SeeKeyRangefor details of how to specify ranges.
-
prefixRange
public static KeySet prefixRange(Key prefix)
Creates a key set that covers all keys where the firstprefix.size()components matchprefixexactly.
-
all
public static KeySet all()
Creates a key set that will retrieve all rows of a table or index.
-
newBuilder
public static KeySet.Builder newBuilder()
Returns a new builder that can be used to construct a key set.
-
isAll
public boolean isAll()
Indicates whether the set will retrieve all rows in a table or index.
-
toBuilder
public KeySet.Builder toBuilder()
Returns a builder initialized with the contents of this set.
-
-