Package org.yaml.snakeyaml.composer
Class Composer
- java.lang.Object
-
- org.yaml.snakeyaml.composer.Composer
-
public class Composer extends Object
Creates a node graph from parser events.Corresponds to the 'Compose' step as described in chapter 3.1 of the YAML Specification.
-
-
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 booleancheckNode()Checks if further documents are available.protected NodecomposeKeyNode(MappingNode node)To be able to override composeNode(node) which is a keyprotected voidcomposeMappingChildren(List<NodeTuple> children, MappingNode node)Compose the members of mappingprotected NodecomposeMappingNode(String anchor)protected NodecomposeScalarNode(String anchor, List<CommentLine> blockComments)protected NodecomposeSequenceNode(String anchor)protected NodecomposeValueNode(MappingNode node)To be able to override composeNode(node) which is a valueNodegetNode()Reads and composes the next document.NodegetSingleNode()Reads a document from a source that contains only one document.
-
-
-
Field Detail
-
parser
protected final Parser parser
its parser
-
-
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:
trueif 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
nullif 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
nullif no document is available.
-
composeScalarNode
protected Node composeScalarNode(String anchor, List<CommentLine> blockComments)
-
composeMappingChildren
protected void composeMappingChildren(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
-
-