Class GeneratorNodeExtensions

  • Direct Known Subclasses:
    TracingSugar

    public class GeneratorNodeExtensions
    extends java.lang.Object
    A builder API to create generator node trees
    • Constructor Detail

      • GeneratorNodeExtensions

        public GeneratorNodeExtensions()
    • Method Detail

      • indent

        public CompositeGeneratorNode indent​(CompositeGeneratorNode parent,
                                             java.lang.String indentString)
        Appends the indentation string at the current position of the parent and adds a new composite node, indicating the same indentation for subsequent lines.
        Returns:
        an indentation node, using the given indentString, appended as a child on the given parent
      • appendNewLineIfNotEmpty

        public CompositeGeneratorNode appendNewLineIfNotEmpty​(CompositeGeneratorNode parent)
        Appends a line separator node that will only be effective if the current line contains non-whitespace text.
        Returns:
        the given parent node
      • append

        public CompositeGeneratorNode append​(CompositeGeneratorNode parent,
                                             java.lang.Object object)
        Creates a text node containing the toString() representation of the given object and appends it to the given parent node.
        Returns:
        the given parent node
      • appendTemplate

        public CompositeGeneratorNode appendTemplate​(CompositeGeneratorNode parent,
                                                     org.eclipse.xtend2.lib.StringConcatenationClient templateString)
        Creates a template node for the given templateString and appends it to the given parent node. Templates are translated to generator node trees and expressions in templates can be of type IGeneratorNode.
        Returns:
        the given parent node