public final class Keys extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
Keys.Key
A
parsed key that includes information about
it's Keys.KeyType and some other data that may be useful in further
processing. |
static class |
Keys.KeyType
The various kinds of keys that can be
parsed. |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
isFunctionKey(String key)
Return
true if key is a function key. |
static boolean |
isNavigationKey(String key)
Return
true if key is a navigation key. |
static boolean |
isTemporalKey(String key)
Return
true if key is a single-leaf bracket-annotated key
(e.g. |
static boolean |
isWritable(String key)
Return
true if the key is a valid data key for writing. |
static Keys.Key |
parse(String key)
Parse
key and return a Keys.Key object that contains the
relevant information. |
static List<Keys.Key> |
parseAll(Collection<String> keys)
Parse every entry of
keys and return the resulting Keys in iteration order. |
static void |
requireNotParameterized(String key,
String context)
Verify that
key carries no bracket-timestamp parameter and throw
a contextual IllegalArgumentException otherwise. |
static void |
requireWritable(String key,
String context)
|
static KeyTokenSymbol<?> |
toKeyTokenSymbol(String key)
Convert
key to its corresponding KeyTokenSymbol subclass. |
static ImplicitKeyRecordFunction |
tryParseFunction(String key)
If possible, parse the
Function that is expressed by the
key. |
public static boolean isFunctionKey(String key)
true if key is a function key. A key that
cannot be parsed is treated as not a function key
and yields false.key - the key string to classifytrue if the provided key is a function keypublic static boolean isNavigationKey(String key)
true if key is a navigation key. A single-leaf
bracket-annotated key (e.g. "name[1]") classifies as a
Keys.KeyType.TEMPORAL_KEY, not a navigation key, so this predicate
distinguishes single-leaf forms from multi-stop paths. A key that
cannot be parsed is treated as not a navigation
key and yields false.key - the key string to classifytrue if the provided key is a valid navigation
keypublic static boolean isTemporalKey(String key)
true if key is a single-leaf bracket-annotated key
(e.g. "name[1]"). Multi-stop paths whose stops carry brackets
(e.g. "a[1].b") classify as navigation keys, not temporal keys, so this predicate distinguishes the
single-leaf form. A key that cannot be parsed is treated as not a temporal key and yields false.key - the key string to classifytrue if the provided key is a temporal keypublic static boolean isWritable(String key)
true if the key is a valid data key for writing. A
key that carries a bracket-timestamp parameter is not a writable key,
regardless of where the bracket appears. A key that cannot be
parsed is treated as not writable and yields
false.key - the key string to classifytrue if the provided key is valid for writingpublic static Keys.Key parse(String key)
key and return a Keys.Key object that contains the
relevant information.key - the key string to parseKeys.Key, never Keys.KeyType.INVALID_KEYIllegalArgumentException - when key is empty, fails the
writable/identifier/function/navigation classification, or
carries a malformed or non-positive bracket-timestamp
parameter; the message names the offending keypublic static List<Keys.Key> parseAll(Collection<String> keys)
keys and return the resulting Keys in iteration order.keys - the key strings to parseKeys, in the order yielded by keysIllegalArgumentException - if any entry of keys fails
validation; the message names the offending entrypublic static KeyTokenSymbol<?> toKeyTokenSymbol(String key)
key to its corresponding KeyTokenSymbol subclass.
An annotated single-leaf key yields a TemporalKeySymbol; a
dot-separated or transitive path yields a NavigationKeySymbol
(whose stops carry any per-stop parameters the input encodes); every
other form — including input that cannot be parsed — yields a
plain KeySymbol wrapping the raw key.key - the key string to convertKeyTokenSymbol that represents keypublic static void requireNotParameterized(String key, String context)
key carries no bracket-timestamp parameter and throw
a contextual IllegalArgumentException otherwise. The
String-input counterpart to
KeyTokenSymbol.requireNotParameterized(KeyTokenSymbol, String).key - the key to verifycontext - a short label naming the rejecting operation, used
verbatim in the exception messageIllegalArgumentException - when key carries any
bracket-timestamp parameter, with a message naming both
context and keypublic static void requireWritable(String key, String context)
key is a writable key
and throw a contextual IllegalArgumentException otherwise. The
String-input counterpart to isWritable(String), intended
for operations that read or write storage directly and therefore reject
navigation, function, identifier, and bracket-annotated forms uniformly.key - the key to verifycontext - a short label naming the rejecting operation, used
verbatim in the exception messageIllegalArgumentException - when key is not a
Keys.KeyType.WRITABLE_KEY, with a message naming both
context and key