Top Description Fields Constructors Methods
org.yaml.snakeyaml.composer

public Class Composer

extends Object
Class Inheritance
Imports
java.util.ArrayList, .Collections, .HashMap, .HashSet, .List, .Map, .Set, org.yaml.snakeyaml.DumperOptions.FlowStyle, .LoaderOptions, org.yaml.snakeyaml.comments.CommentEventsCollector, .CommentLine, .CommentType, org.yaml.snakeyaml.error.Mark, .YAMLException, org.yaml.snakeyaml.events.AliasEvent, .Event, .MappingStartEvent, .NodeEvent, .ScalarEvent, .SequenceStartEvent, org.yaml.snakeyaml.nodes.MappingNode, .Node, .NodeId, .NodeTuple, .ScalarNode, .SequenceNode, .Tag, org.yaml.snakeyaml.parser.Parser, org.yaml.snakeyaml.resolver.Resolver

Creates a node graph from parser events.

Corresponds to the 'Compose' step as described in chapter 3.1 of the YAML Specification.

Field Summary

Modifier and TypeField and Description
private final Map<String, Node>
private final CommentEventsCollector
private final CommentEventsCollector
private final LoaderOptions
private int
private final int
private int
protected final Parser
parser

its parser

private final Set<Node>
private final Resolver

Constructor Summary

AccessConstructor and Description
public
Composer(Parser
- the parser
parser
,
Resolver
- the resolver
resolver
,
LoaderOptions
- options
loadingConfig
)

Create

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

true if there is at least one more document.
checkNode
()

Checks if further documents are available.

protected Node

Returns:

node
composeKeyNode
(MappingNode
- the source
node
)

To be able to override composeNode(node) which is a key

protected void
composeMappingChildren(List<NodeTuple>
- the data to fill
children
,
MappingNode
- the source
node
)

Compose the members of mapping

protected Node
private Node
composeNode(Node parent)

protected Node
composeScalarNode(String anchor, List<CommentLine> blockComments)

protected Node
protected Node

Returns:

node
composeValueNode
(MappingNode
- the source
node
)

To be able to override composeNode(node) which is a value

private void
decreaseNestingDepth()

Indicate that the collection is finished and the nesting is decreased

public Node

Returns:

The root node of the document or null if no more documents are available.
getNode
()

Reads and composes the next document.

public Node

Returns:

The root node of the document or null if no document is available.
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

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

anchorsback to summary
private final Map<String, Node> anchors
blockCommentsCollectorback to summary
private final CommentEventsCollector blockCommentsCollector
inlineCommentsCollectorback to summary
private final CommentEventsCollector inlineCommentsCollector
loadingConfigback to summary
private final LoaderOptions loadingConfig
nestingDepthback to summary
private int nestingDepth
nestingDepthLimitback to summary
private final int nestingDepthLimit
nonScalarAliasesCountback to summary
private int nonScalarAliasesCount
parserback to summary
protected final Parser parser

its parser

recursiveNodesback to summary
private final Set<Node> recursiveNodes
resolverback to summary
private final Resolver resolver

Constructor Detail

Composerback to summary
public Composer(Parser parser, Resolver resolver, LoaderOptions loadingConfig)

Create

Parameters
parser:Parser

- the parser

resolver:Resolver

- the resolver

loadingConfig:LoaderOptions

- options

Method Detail

checkNodeback to summary
public boolean checkNode()

Checks if further documents are available.

Returns:boolean

true if there is at least one more document.

composeKeyNodeback to summary
protected Node composeKeyNode(MappingNode node)

To be able to override composeNode(node) which is a key

Parameters
node:MappingNode

- the source

Returns:Node

node

composeMappingChildrenback to summary
protected void composeMappingChildren(List<NodeTuple> children, MappingNode node)

Compose the members of mapping

Parameters
children:List<NodeTuple>

- the data to fill

node:MappingNode

- the source

composeMappingNodeback to summary
protected Node composeMappingNode(String anchor)
composeNodeback to summary
private Node composeNode(Node parent)
composeScalarNodeback to summary
protected Node composeScalarNode(String anchor, List<CommentLine> blockComments)
composeSequenceNodeback to summary
protected Node composeSequenceNode(String anchor)
composeValueNodeback to summary
protected Node composeValueNode(MappingNode node)

To be able to override composeNode(node) which is a value

Parameters
node:MappingNode

- the source

Returns:Node

node

decreaseNestingDepthback to summary
private void decreaseNestingDepth()

Indicate that the collection is finished and the nesting is decreased

getNodeback to summary
public Node getNode()

Reads and composes the next document.

Returns:Node

The root node of the document or null if no more documents are available.

getSingleNodeback to summary
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:Node

The root node of the document or null if no document is available.

increaseNestingDepthback to summary
private void increaseNestingDepth()

Increase nesting depth and fail when it exceeds the denied limit