Class Composer

  • All Implemented Interfaces:
    Iterator<Node>

    public class Composer
    extends Object
    implements Iterator<Node>
    Creates a node graph from parser events.

    Corresponds to the 'Composer' step as described in chapter 3.1.2 of the YAML Specification.

    • Field Detail

      • parser

        protected final Parser parser
    • Constructor Detail

      • Composer

        public Composer​(Parser parser,
                        LoadSettings settings)
        Deprecated.
        use the other constructor with LoadSettings first
    • Method Detail

      • hasNext

        public boolean hasNext()
        Checks if further documents are available.
        Specified by:
        hasNext in interface Iterator<Node>
        Returns:
        true if there is at least one more document.
      • getSingleNode

        public Optional<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 Optional.empty() if no document is available.
      • next

        public Node next()
        Reads and composes the next document.
        Specified by:
        next in interface Iterator<Node>
        Returns:
        The root node of the document or null if no more documents are available.