Class AddToTagVisitor<P>


  • public class AddToTagVisitor<P>
    extends XmlVisitor<P>
    • Constructor Detail

      • AddToTagVisitor

        public AddToTagVisitor​(Xml.Tag scope,
                               Xml.Tag tagToAdd)
      • AddToTagVisitor

        public AddToTagVisitor​(Xml.Tag scope,
                               Xml.Tag tagToAdd,
                               @Nullable
                               @Nullable java.util.Comparator<Content> tagComparator)
    • Method Detail

      • addToTag

        public static Xml.Tag addToTag​(Xml.Tag parent,
                                       Xml.Tag newChild,
                                       org.openrewrite.Cursor parentCursor)
        Add a tag to the children of another tag
        Parameters:
        parent - the tag that will have 'newChild' added to its children
        newChild - the tag to add as a child of 'parent'
        parentCursor - A cursor pointing one level above 'parent'. Determines the final indentation of 'newChild'.
        Returns:
        'parent' with 'newChild' amongst its child elements
      • addToTag

        public static Xml.Tag addToTag​(Xml.Tag parentScope,
                                       Xml.Tag parent,
                                       Xml.Tag newChild,
                                       org.openrewrite.Cursor parentCursor)
        Add a tag to the children of another tag
        Parameters:
        parentScope - a tag which contains 'parent' as a direct or transitive child element.
        parent - the tag that will have 'newChild' added to its children
        newChild - the tag to add as a child of 'parent'
        parentCursor - A cursor pointing one level above 'parentScope'. Determines the final indentation of 'newChild'.
        Returns:
        'parentScope' which somewhere contains 'parent' with 'newChild' amongst its child elements