Package org.snakeyaml.engine.v2.composer
Class Composer
java.lang.Object
org.snakeyaml.engine.v2.composer.Composer
Creates a node graph from parser events.
Corresponds to the 'Composer' step as described in chapter 3.1.2 of the YAML Specification.
It implementsIterator to get the stream of Nodes from the input.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final CommentEventsCollectorprivate final CommentEventsCollectorprivate intprotected final ParserEvent parserprivate final ScalarResolverprivate final LoadSettings -
Constructor Summary
ConstructorsConstructorDescriptionComposer(LoadSettings settings, Parser parser) CreateComposer(Parser parser, LoadSettings settings) Deprecated.use the other constructor with LoadSettings first -
Method Summary
Modifier and TypeMethodDescriptionprotected NodecomposeKeyNode(MappingNode node) To be able to override composeNode(node) which is a keyprotected voidcomposeMappingChildren(List<NodeTuple> children, MappingNode node) Add the provided Node to the children as the last childprotected NodecomposeMappingNode(Optional<Anchor> anchor) Create mapping Nodeprivate NodecomposeNode(Optional<Node> parent) protected NodecomposeScalarNode(Optional<Anchor> anchor, List<CommentLine> blockComments) Create ScalarNodeprotected SequenceNodecomposeSequenceNode(Optional<Anchor> anchor) Compose a sequence Node from the input starting with SequenceStartEventprotected NodecomposeValueNode(MappingNode node) To be able to override composeNode(node) which is a valueReads a document from a source that contains only one document.booleanhasNext()Checks if further documents are available.next()Reads and composes the next document.private voidregisterAnchor(Anchor anchor, Node node) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Iterator
forEachRemaining, remove
-
Field Details
-
parser
Event parser -
scalarResolver
-
anchors
-
recursiveNodes
-
settings
-
blockCommentsCollector
-
inlineCommentsCollector
-
nonScalarAliasesCount
private int nonScalarAliasesCount
-
-
Constructor Details
-
Composer
Deprecated.use the other constructor with LoadSettings first- Parameters:
parser- - the inputsettings- - configuration options
-
Composer
Create- Parameters:
settings- - configuration optionsparser- - the input
-
-
Method Details
-
hasNext
public boolean hasNext()Checks if further documents are available. -
getSingleNode
Reads a document from a source that contains only one document.If the stream contains more than one document an exception is thrown.
- Returns:
- The root node of the document or
Optional.empty()if no document is available.
-
next
Reads and composes the next document. -
composeNode
-
registerAnchor
-
composeScalarNode
Create ScalarNode- Parameters:
anchor- - anchor if presentblockComments- - comments before the Node- Returns:
- Node
-
composeSequenceNode
Compose a sequence Node from the input starting with SequenceStartEvent- Parameters:
anchor- - anchor if present- Returns:
- parsed Node
-
composeMappingNode
Create mapping Node- Parameters:
anchor- - anchor if present- Returns:
- Node
-
composeMappingChildren
Add the provided Node to the children as the last child- Parameters:
children- - the list to be extendednode- - the child to the children
-
composeKeyNode
To be able to override composeNode(node) which is a key- Parameters:
node- - the source- Returns:
- node
-
composeValueNode
To be able to override composeNode(node) which is a value- Parameters:
node- - the source- Returns:
- node
-