java.lang.Comparable<Config.Key>
public static interface Config.Key extends java.lang.Comparable<Config.Key>
Fully-qualified key is list of key tokens separated by .
(dot character).
Depending on context the key token is evaluated one by one:
Config.Type.OBJECT
node the token represents a name of object member;Config.Type.LIST
node the token represents an zero-based index of list element,
an unsigned base-10 integer value, leading zeros are not allowed.The ABNF syntax of config key is:
config-key = *1( key-token *( "." key-token ) )
key-token = *( unescaped / escaped )
unescaped = %x00-2D / %x2F-7D / %x7F-10FFFF
; %x2E ('.') and %x7E ('~') are excluded from 'unescaped'
escaped = "~" ( "0" / "1" )
; representing '~' and '.', respectively
Config.key()
Modifier and Type | Method | Description |
---|---|---|
static java.lang.String |
escapeName(java.lang.String name) |
Escape
'~' to ~0 and '.' to ~1 in specified name. |
default boolean |
isRoot() |
Returns
true in case the key represents root config node,
otherwise it returns false . |
java.lang.String |
name() |
Returns the name of Config node.
|
static Config.Key |
of(java.lang.String key) |
Creates new instance of Key for specified
key literal. |
Config.Key |
parent() |
Returns instance of Key that represents key of parent config node.
|
java.lang.String |
toString() |
Returns formatted fully-qualified key.
|
static java.lang.String |
unescapeName(java.lang.String escapedName) |
Unescape
~0 to '~' and ~1 to '.' in specified escaped name. |
Config.Key parent()
If the key represents root config node it returns null
.
isRoot()
default boolean isRoot()
true
in case the key represents root config node,
otherwise it returns false
.true
in case the key represents root node, otherwise false
.parent()
java.lang.String name()
The name of a node is the last token in fully-qualified key. Depending on context the name is evaluated one by one:
Config.Type.OBJECT
node the name represents a name of object member;Config.Type.LIST
node the name represents an zero-based index of list element,
an unsigned base-10 integer value, leading zeros are not allowed.Config.name()
java.lang.String toString()
toString
in class java.lang.Object
static Config.Key of(java.lang.String key)
key
literal.
Empty literal means root node. Character dot ('.') has special meaning - it separates fully-qualified key by key tokens (node names).
key
- formatted fully-qualified key.static java.lang.String escapeName(java.lang.String name)
'~'
to ~0
and '.'
to ~1
in specified name.name
- name to be escapedstatic java.lang.String unescapeName(java.lang.String escapedName)
~0
to '~'
and ~1
to '.'
in specified escaped name.escapedName
- escaped nameCopyright © 2018 Oracle Corporation. All rights reserved.