public final class YamlUtil extends Object
Modifier and Type | Method and Description |
---|---|
static YamlMapping |
asMapping(YamlNode node)
Takes a generic
YamlNode instance and returns it casted to
YamlMapping if the type of the node is a descendant of
YamlMapping . |
static YamlScalar |
asScalar(YamlNode node)
Takes a generic
YamlNode instance and returns it casted to
YamlScalar if the type of the node is a descendant of
YamlScalar . |
static YamlSequence |
asSequence(YamlNode node)
Takes a generic
YamlNode instance and returns it casted to
YamlSequence if the type of the node is a descendant of
YamlSequence . |
static <T> T |
asType(YamlNode node,
Class<T> type)
Takes a generic
YamlNode instance and returns it casted to
the provided type if the node is an instance of that type. |
static String |
constructPath(YamlNode parent,
String childName)
Constructs the path of the node with the provided
parent
node and nodeName . |
static void |
ensureRunningOnJava8OrHigher()
Checks if the runtime environment is Java8 or higher.
|
static boolean |
isMapping(YamlNode node)
Checks if the provided
node is a mapping |
static boolean |
isOfSameType(YamlNode left,
YamlNode right)
Checks if the two provided
nodes are of the same type |
static boolean |
isScalar(YamlNode node)
Checks if the provided
node is a scalar |
static boolean |
isSequence(YamlNode node)
Checks if the provided
node is a sequence |
public static YamlMapping asMapping(YamlNode node)
YamlNode
instance and returns it casted to
YamlMapping
if the type of the node is a descendant of
YamlMapping
.node
- The generic node to castYamlException
- if the provided node is not a mappingpublic static YamlSequence asSequence(YamlNode node)
YamlNode
instance and returns it casted to
YamlSequence
if the type of the node is a descendant of
YamlSequence
.node
- The generic node to castYamlException
- if the provided node is not a sequencepublic static YamlScalar asScalar(YamlNode node)
YamlNode
instance and returns it casted to
YamlScalar
if the type of the node is a descendant of
YamlScalar
.node
- The generic node to castYamlException
- if the provided node is not a scalarpublic static <T> T asType(YamlNode node, Class<T> type)
YamlNode
instance and returns it casted to
the provided type
if the node is an instance of that type.node
- The generic node to castYamlException
- if the provided node is not the expected typepublic static void ensureRunningOnJava8OrHigher()
UnsupportedOperationException
.UnsupportedOperationException
- If the runtime environment
is not Java8 or higherpublic static String constructPath(YamlNode parent, String childName)
parent
node and nodeName
.parent
- The parent nodechildName
- The name of the node the path is constructed forpublic static boolean isMapping(YamlNode node)
node
is a mappingnode
- The node to checktrue
if the provided node is a mappingpublic static boolean isSequence(YamlNode node)
node
is a sequencenode
- The node to checktrue
if the provided node is a sequencepublic static boolean isScalar(YamlNode node)
node
is a scalarnode
- The node to checktrue
if the provided node is a scalarCopyright © 2020 Hazelcast, Inc.. All Rights Reserved.