public class YamlMappingImpl extends AbstractYamlNode implements MutableYamlMapping
UNNAMED_NODE| Modifier and Type | Method and Description |
|---|---|
void |
addChild(String name,
YamlNode node)
Adds a new child node to the mapping with the provided name
|
YamlNode |
child(String name)
Gets a child node by its name
|
YamlMapping |
childAsMapping(String name)
Gets a child mapping node by its name
|
YamlScalar |
childAsScalar(String name)
Gets a child scalar node by its name
|
<T> T |
childAsScalarValue(String name)
Gets a child scalar node's value by its name
See
YamlScalar for the possible types
Please note that if the scalar's type is not the expected type T,
a ClassCastException is thrown at the call site. |
<T> T |
childAsScalarValue(String name,
Class<T> type)
Gets a child scalar node's value by its name with type hinting
See
YamlScalar for the possible types |
YamlSequence |
childAsSequence(String name)
Gets a child sequence node by its name
|
int |
childCount()
Returns the number of the children that the collection has
|
Iterable<YamlNode> |
children()
Returns the children nodes
|
Iterable<YamlNameNodePair> |
childrenPairs()
Returns the children as
YamlNameNodePairs
This method may have null values as the childNode
in the returned pairs if the node's values is explicitly defined
as !!null in the YAML document. |
void |
removeChild(String name)
Removes a child with the given name if exists
|
String |
toString() |
nodeName, parent, path, setNodeNameclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitsetNodeNamepublic YamlNode child(String name)
YamlMappingchild in interface YamlMappingname - the name of the child nodenull otherwisepublic YamlMapping childAsMapping(String name)
YamlMappingchildAsMapping in interface YamlMappingname - the name of the child nodenull otherwisepublic YamlSequence childAsSequence(String name)
YamlMappingchildAsSequence in interface YamlMappingname - the name of the child nodenull otherwisepublic YamlScalar childAsScalar(String name)
YamlMappingchildAsScalar in interface YamlMappingname - the name of the child nodenull otherwisepublic <T> T childAsScalarValue(String name)
YamlMappingYamlScalar for the possible types
Please note that if the scalar's type is not the expected type T,
a ClassCastException is thrown at the call site.childAsScalarValue in interface YamlMappingname - the name of the child nodenull otherwiseYamlScalar,
YamlMapping.childAsScalarValue(String, Class)public <T> T childAsScalarValue(String name, Class<T> type)
YamlMappingYamlScalar for the possible typeschildAsScalarValue in interface YamlMappingname - the name of the child nodetype - the type that the scalar's value type to be validated
againstYamlScalarpublic Iterable<YamlNode> children()
YamlCollectionchildren in interface YamlCollectionpublic Iterable<YamlNameNodePair> childrenPairs()
YamlMappingYamlNameNodePairs
This method may have null values as the childNode
in the returned pairs if the node's values is explicitly defined
as !!null in the YAML document.
The difference from the YamlCollection.children() children method is
that YamlCollection.children() does not return null children
nodes, while YamlMapping.childrenPairs() does.childrenPairs in interface YamlMappingIterable pair of node names and node instancespublic void addChild(String name, YamlNode node)
MutableYamlMappingaddChild in interface MutableYamlMappingname - The name of the new childnode - The child nodepublic void removeChild(String name)
MutableYamlMappingremoveChild in interface MutableYamlMappingname - The name of the child to removepublic int childCount()
YamlCollectionchildCount in interface YamlCollectionCopyright © 2019 Hazelcast, Inc.. All Rights Reserved.