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