public final class StrictYamlMapping extends Object
YamlMapping
which throws
YamlNodenotFoundException, instead of returning null,
if a given key doesn't exist in the mapping, or if it points
to a different type of node than the demanded one.Constructor and Description |
---|
StrictYamlMapping(YamlMapping decorated)
Ctor.
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(YamlNode other)
Compare this Mapping to another node.
A Mapping is always considered greater than a Scalar or a Sequence. If other is a Mapping, their integer lengths are compared - the one with the greater length is considered greater. |
boolean |
equals(Object other)
Equals method for YamlMapping.
|
int |
hashCode() |
String |
indent(int indentation)
Indent this YamlMapping.
|
Set<YamlNode> |
keys()
Return the keys' set of this mapping.
Pay attention: the keys are ordered. |
String |
string(String key)
Get the String associated with the given key.
|
String |
string(YamlNode key)
Get the String associated with the given key.
|
String |
toString() |
YamlNode |
value(YamlNode key)
Get the YamlNode mapped to the specified key.
|
Collection<YamlNode> |
values()
Fetch the values.
|
YamlMapping |
yamlMapping(String key)
Get the Yaml mapping associated with the given key.
|
YamlMapping |
yamlMapping(YamlNode key)
Get the Yaml mapping associated with the given key.
|
YamlSequence |
yamlSequence(String key)
Get the Yaml sequence associated with the given key.
|
YamlSequence |
yamlSequence(YamlNode key)
Get the Yaml sequence associated with the given key.
|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
date, date, dateTime, dateTime, doubleNumber, doubleNumber, floatNumber, floatNumber, integer, integer, longNumber, longNumber
public StrictYamlMapping(YamlMapping decorated)
decorated
- Original YamlMappingpublic Collection<YamlNode> values()
YamlNode
YamlNode
public YamlMapping yamlMapping(String key)
YamlMapping
key
- String keypublic YamlMapping yamlMapping(YamlNode key)
YamlMapping
key
- Yaml node (mapping or sequence) keypublic YamlSequence yamlSequence(String key)
YamlMapping
key
- String keypublic YamlSequence yamlSequence(YamlNode key)
YamlMapping
key
- Yaml node (mapping or sequence) keypublic String string(String key)
YamlMapping
key
- String keypublic String string(YamlNode key)
YamlMapping
key
- Yaml node (mapping or sequence) keypublic String indent(int indentation)
YamlMapping
indentation
- Indentation to start with. Usually, it's 0, since we
don't want to have spaces at the beginning. But in the case of nested
YamlNodes, this value may be greater than 0.public Set<YamlNode> keys()
YamlMapping
public YamlNode value(YamlNode key)
YamlMapping
key
- YamlNode key. Could be a simple scalar,
a YamlMapping or a YamlSequence.public boolean equals(Object other)
public int compareTo(YamlNode other)
compareTo
in interface Comparable<YamlNode>
other
- The other AbstractNode.Copyright © 2020. All rights reserved.