Package org.yaml.snakeyaml.composer
Class Composer
java.lang.Object
org.yaml.snakeyaml.composer.Composer
Creates a node graph from parser events.
Corresponds to the 'Compose' step as described in chapter 3.1 of the YAML Specification.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final CommentEventsCollector
private final CommentEventsCollector
private final LoaderOptions
private int
private final int
private int
protected final Parser
its parserprivate final Resolver
-
Constructor Summary
ConstructorsConstructorDescriptionComposer
(Parser parser, Resolver resolver, LoaderOptions loadingConfig) Create -
Method Summary
Modifier and TypeMethodDescriptionboolean
Checks if further documents are available.protected Node
composeKeyNode
(MappingNode node) To be able to override composeNode(node) which is a keyprotected void
composeMappingChildren
(List<NodeTuple> children, MappingNode node) Compose the members of mappingprotected Node
composeMappingNode
(String anchor) private Node
composeNode
(Node parent) protected Node
composeScalarNode
(String anchor, List<CommentLine> blockComments) protected Node
composeSequenceNode
(String anchor) protected Node
composeValueNode
(MappingNode node) To be able to override composeNode(node) which is a valueprivate void
Indicate that the collection is finished and the nesting is decreasedgetNode()
Reads and composes the next document.Reads a document from a source that contains only one document.private void
Increase nesting depth and fail when it exceeds the denied limit
-
Field Details
-
parser
its parser -
resolver
-
anchors
-
recursiveNodes
-
nonScalarAliasesCount
private int nonScalarAliasesCount -
loadingConfig
-
blockCommentsCollector
-
inlineCommentsCollector
-
nestingDepth
private int nestingDepth -
nestingDepthLimit
private final int nestingDepthLimit
-
-
Constructor Details
-
Composer
Create- Parameters:
parser
- - the parserresolver
- - the resolverloadingConfig
- - options
-
-
Method Details
-
checkNode
public boolean checkNode()Checks if further documents are available.- Returns:
true
if there is at least one more document.
-
getNode
Reads and composes the next document.- Returns:
- The root node of the document or
null
if no more 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
null
if no document is available.
-
composeNode
-
composeScalarNode
-
composeSequenceNode
-
composeMappingNode
-
composeMappingChildren
Compose the members of mapping- Parameters:
children
- - the data to fillnode
- - the source
-
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
-
increaseNestingDepth
private void increaseNestingDepth()Increase nesting depth and fail when it exceeds the denied limit -
decreaseNestingDepth
private void decreaseNestingDepth()Indicate that the collection is finished and the nesting is decreased
-