@Immutable public static final class Keys.Key extends Object
parsed key that includes information about
it's Keys.KeyType and some other data that may be useful in further
processing.| Modifier and Type | Method and Description |
|---|---|
String |
baseKey()
Return the canonical key string this
Keys.Key represents with
every read-time parameter stripped. |
<T> T |
data()
Return the data associated with this
Keys.Key. |
long |
effectiveTimestamp(long defaultTimestamp)
Return the read timestamp pinned to this
Keys.Key when it carries
a bracket-timestamp parameter, or defaultTimestamp otherwise. |
boolean |
isFullyParameterized()
Return
true when every read this Keys.Key implies is
pinned by a bracket-derived timestamp. |
boolean |
isParameterized()
Return
true when this Keys.Key carries a read-time
parameter anywhere in its structure — either on a single leaf
(a Keys.KeyType.TEMPORAL_KEY) or on at least one stop of a
Keys.KeyType.NAVIGATION_KEY. |
long |
timestamp()
Return the bracket-derived timestamp pinned to this
Keys.Key. |
String |
toString() |
Keys.KeyType |
type()
Return the
Keys.KeyType. |
String |
value()
Return the value of this
Keys.Key. |
public String baseKey()
Keys.Key represents with
every read-time parameter stripped. For non-parameterized types this
is identical to value().public <T> T data()
Keys.Key.
The shape of the returned object depends on type():
Keys.KeyType.NAVIGATION_KEY returns the underlying
NavigationKeySymbol, whose stops carry any per-stop bracket-timestamp parameters.Keys.KeyType.TEMPORAL_KEY returns the underlying
TemporalKeySymbol, which exposes the bracket-derived
timestamp() and the baseKey().Keys.KeyType.FUNCTION_KEY returns the result of
Keys.tryParseFunction(String).public long effectiveTimestamp(long defaultTimestamp)
Keys.Key when it carries
a bracket-timestamp parameter, or defaultTimestamp otherwise.
Defined only for single-key contexts. A
Keys.KeyType.NAVIGATION_KEY has no single effective timestamp
because its stops are independently pinned.
defaultTimestamp - the timestamp this Keys.Key represents
when it carries no bracket parameterIllegalStateException - when this Keys.Key is a
Keys.KeyType.NAVIGATION_KEYpublic boolean isFullyParameterized()
true when every read this Keys.Key implies is
pinned by a bracket-derived timestamp. A Keys.KeyType.TEMPORAL_KEY
satisfies this by definition; a Keys.KeyType.NAVIGATION_KEY
satisfies it only when every one of its
stops carries a parameter. Any
other Keys.KeyType returns false.
The distinction from isParameterized() matters when the
caller needs to know whether the read is wholly historical — a
partially-parameterized navigation key is parameterized but still
touches the present at its unbracketed stops.
NOTE: Keys.KeyType.IDENTIFIER_KEY returns
false even though the record identifier is itself
timestamp-invariant. Operationally, $id$ has two semantics:
it is timestamp-invariant when projected from a record that the
caller has already resolved, but enumerating semantics evaluate at
the present moment. Because the parsed Keys.Key cannot distinguish
the two call shapes, this method is conservative and never claims an
Keys.KeyType.IDENTIFIER_KEY is bracket-pinned; consumers that can
prove the identity-projection case must encode the optimization at
the call site.
true when every read implied by this Keys.Key is
bracket-pinnedpublic boolean isParameterized()
true when this Keys.Key carries a read-time
parameter anywhere in its structure — either on a single leaf
(a Keys.KeyType.TEMPORAL_KEY) or on at least one stop of a
Keys.KeyType.NAVIGATION_KEY.true if any parameter is presentpublic long timestamp()
Keys.Key.
Defined only for Keys.KeyType.TEMPORAL_KEY. A
Keys.KeyType.NAVIGATION_KEY carries per-stop timestamps; read them
from the stops of the
NavigationKeySymbol exposed by data().
IllegalStateException - when this Keys.Key is not a
Keys.KeyType.TEMPORAL_KEYpublic Keys.KeyType type()
Keys.KeyType.