Class MapTagChildrenVisitor<T>

java.lang.Object
org.openrewrite.TreeVisitor<Xml,P>
org.openrewrite.xml.XmlVisitor<T>
org.openrewrite.xml.MapTagChildrenVisitor<T>

public class MapTagChildrenVisitor<T> extends XmlVisitor<T>
Applies a transformation to the children of the specified tag.
  • Field Details

  • Constructor Details

    • MapTagChildrenVisitor

      public MapTagChildrenVisitor()
  • Method Details

    • visitTag

      public Xml visitTag(Xml.Tag tag, T ctx)
      Overrides:
      visitTag in class XmlVisitor<T>
    • mapChildren

      public static Xml.Tag mapChildren(Xml.Tag parent, UnaryOperator<Content> map)
      Transform the children of a tag with the supplied mapping function.
      Parameters:
      parent - the tag whose direct child elements are to be transformed by 'map'.
      map - the function used to transform the direct child elements of 'parent'.
      Returns:
      'parent' with its children transformed by 'map'
    • mapChildren

      public static Xml.Tag mapChildren(Xml.Tag parentScope, Xml.Tag parent, UnaryOperator<Content> map)
      Transform the children of a tag with the supplied mapping function.
      Parameters:
      parentScope - a tag which contains 'parent' as a direct or transitive child element.
      parent - the tag whose direct child elements are to be transformed by 'map'.
      map - the function used to transform the direct child elements of 'parent'.
      Returns:
      'parentScope' which somewhere contains 'parent' with its children transformed by 'map'
    • mapTagChildren

      public static Xml.Tag mapTagChildren(Xml.Tag parent, UnaryOperator<Xml.Tag> map)
    • mapTagChildren

      public static Xml.Tag mapTagChildren(Xml.Tag parentScope, Xml.Tag parent, UnaryOperator<Xml.Tag> map)