Package com.amihaiemil.eoyaml
Interface YamlNode
-
- All Superinterfaces:
Comparable<YamlNode>
- All Known Subinterfaces:
Scalar
,YamlMapping
,YamlSequence
,YamlStream
- All Known Implementing Classes:
BaseYamlMapping
,BaseYamlSequence
,EmptyYamlMapping
,EmptyYamlSequence
,MergedYamlMapping
,MergedYamlSequence
,StrictYamlMapping
,StrictYamlSequence
public interface YamlNode extends Comparable<YamlNode>
YAML node.- Since:
- 1.0.0
- Version:
- $Id: 6f2d803bb0aafbdcc5a24f68c05992f305ac4e3d $
- Author:
- Mihai Andronache ([email protected])
- See Also:
- Spec1.2/node
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description <T extends YamlNode>
TasClass(Class<T> clazz, Node type)
Gives theYamlNode
instance from node class and node type.YamlMapping
asMapping()
Gives a Mapping value of the node.Scalar
asScalar()
Gives a String value of the node.YamlSequence
asSequence()
Gives a Sequence value of the node.YamlStream
asStream()
Gives a Stream value of the node.Comment
comment()
Comment referring to this Node.boolean
isEmpty()
Is this YamlNode empty?Node
type()
Type of the node.-
Methods inherited from interface java.lang.Comparable
compareTo
-
-
-
-
Method Detail
-
isEmpty
boolean isEmpty()
Is this YamlNode empty?- Returns:
- True or false.
-
comment
Comment comment()
Comment referring to this Node.- Returns:
- Comment. If there is no comment, it will return an "empty" comment (an instance of Comment with empty-string value()).
-
type
Node type()
Type of the node.- Returns:
- Node type.
-
asScalar
Scalar asScalar() throws YamlReadingException, ClassCastException
Gives a String value of the node.- Returns:
- String value of the node.
- Throws:
YamlReadingException
- If the node type is not Scalar.ClassCastException
- If the node type couldn't defined correctly.
-
asMapping
YamlMapping asMapping() throws YamlReadingException, ClassCastException
Gives a Mapping value of the node.- Returns:
- Mapping value of the node.
- Throws:
YamlReadingException
- If the node type is not Mapping.ClassCastException
- If the node type couldn't defined correctly.
-
asSequence
YamlSequence asSequence() throws YamlReadingException, ClassCastException
Gives a Sequence value of the node.- Returns:
- Sequence value of the node.
- Throws:
YamlReadingException
- If the node type is not Sequence.ClassCastException
- If the node type couldn't defined correctly.
-
asStream
YamlStream asStream() throws YamlReadingException, ClassCastException
Gives a Stream value of the node.- Returns:
- Stream value of the node.
- Throws:
YamlReadingException
- If the node type is not Stream.ClassCastException
- If the node type couldn't defined correctly.
-
asClass
<T extends YamlNode> T asClass(Class<T> clazz, Node type) throws YamlReadingException, ClassCastException
Gives theYamlNode
instance from node class and node type.- Type Parameters:
T
- Requested aYamlNode
class instance.- Parameters:
clazz
- Requested aYamlNode
class.type
- Requested aNode
.- Returns:
- Requested a
YamlNode
. - Throws:
YamlReadingException
- If the type is not aYamlNode
.ClassCastException
- If the node type couldn't defined correctly.
-
-