K
- The type of the key.V
- The type of the value.@InterfaceStability.Evolving public final class VersionedKeyQuery<K,V> extends Object implements Query<VersionedRecord<V>>
Modifier and Type | Method and Description |
---|---|
VersionedKeyQuery<K,V> |
asOf(Instant asOfTimestamp)
Specifies the timestamp for the key query.
|
Optional<Instant> |
asOfTimestamp()
The timestamp of the query, if specified.
|
K |
key()
The key that was specified for this query.
|
static <K,V> VersionedKeyQuery<K,V> |
withKey(K key)
Creates a query that will retrieve the record from a versioned state store identified by
key if it exists
(or null otherwise). |
public static <K,V> VersionedKeyQuery<K,V> withKey(K key)
key
if it exists
(or null
otherwise).
While the query by default returns the latest value of the specified key
, setting
the asOfTimestamp
(by calling the asOf(Instant)
method), makes the query
to return the value associated to the specified asOfTimestamp
.
K
- The type of the keyV
- The type of the value that will be retrievedkey
- The key to retrieveNullPointerException
- if key
is nullpublic VersionedKeyQuery<K,V> asOf(Instant asOfTimestamp)
asOfTimestamp
- The timestamp of the query.NullPointerException
- if asOfTimestamp
is nullpublic K key()
key
of the query.