Class FilterTagChildrenVisitor<T>

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

public class FilterTagChildrenVisitor<T> extends org.openrewrite.xml.XmlVisitor<T>
Filter the children to only those matching the supplied predicate.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
     
    org.openrewrite.xml.tree.Xml.Tag
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static org.openrewrite.xml.tree.Xml.Tag
    filterChildren(org.openrewrite.xml.tree.Xml.Tag parent, Predicate<Content> childTest)
    Filter the children of a tag to only those that match the supplied predicate.
    static org.openrewrite.xml.tree.Xml.Tag
    filterChildren(org.openrewrite.xml.tree.Xml.Tag parentScope, org.openrewrite.xml.tree.Xml.Tag parent, Predicate<Content> childTest)
    Filter the children of a tag to only those that match the supplied predicate.
    static org.openrewrite.xml.tree.Xml.Tag
    filterTagChildren(org.openrewrite.xml.tree.Xml.Tag parent, Predicate<org.openrewrite.xml.tree.Xml.Tag> childTest)
    Filter the children of a tag to only those that match the supplied predicate.
    static org.openrewrite.xml.tree.Xml.Tag
    filterTagChildren(org.openrewrite.xml.tree.Xml.Tag parentScope, org.openrewrite.xml.tree.Xml.Tag parent, Predicate<org.openrewrite.xml.tree.Xml.Tag> childTest)
    Filter the children of a tag to only those that match the supplied predicate.
    org.openrewrite.xml.tree.Xml
    visitTag(org.openrewrite.xml.tree.Xml.Tag tag, T ctx)
     

    Methods inherited from class org.openrewrite.xml.XmlVisitor

    autoFormat, autoFormat, autoFormat, getLanguage, isAcceptable, maybeAutoFormat, maybeAutoFormat, maybeAutoFormat, visitAttribute, visitAttributeValue, visitCharData, visitComment, visitDocTypeDecl, visitDocTypeDeclExternalSubsets, visitDocument, visitElement, visitIdent, visitJspDirective, visitProcessingInstruction, visitProlog, visitTagClosing, visitXmlDecl

    Methods inherited from class org.openrewrite.TreeVisitor

    adapt, collect, collect, defaultValue, doAfterVisit, getAfterVisit, getCursor, isAdaptableTo, noop, postVisit, preVisit, reduce, reduce, reduce, setCursor, stopAfterPreVisit, updateCursor, visit, visit, visit, visitAndCast, visitAndCast, visitMarker, visitMarkers, visitNonNull, visitNonNull, visitorTreeType

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • scope

      public org.openrewrite.xml.tree.Xml.Tag scope
    • childTest

      public Predicate<Content> childTest
  • Constructor Details

    • FilterTagChildrenVisitor

      public FilterTagChildrenVisitor()
  • Method Details

    • visitTag

      public org.openrewrite.xml.tree.Xml visitTag(org.openrewrite.xml.tree.Xml.Tag tag, T ctx)
      Overrides:
      visitTag in class org.openrewrite.xml.XmlVisitor<T>
    • filterChildren

      public static org.openrewrite.xml.tree.Xml.Tag filterChildren(org.openrewrite.xml.tree.Xml.Tag parent, Predicate<Content> childTest)
      Filter the children of a tag to only those that match the supplied predicate.
      Parameters:
      parent - the tag whose direct child elements are to be filtered by 'childTest'
      childTest - the predicate used to evaluate the direct child elements of 'parent'.
      Returns:
      'parent' with its children that matched 'childTest'
    • filterChildren

      public static org.openrewrite.xml.tree.Xml.Tag filterChildren(org.openrewrite.xml.tree.Xml.Tag parentScope, org.openrewrite.xml.tree.Xml.Tag parent, Predicate<Content> childTest)
      Filter the children of a tag to only those that match the supplied predicate.
      Parameters:
      parentScope - a tag which contains 'parent' as a direct or transitive child element.
      parent - the tag whose direct child elements are to be filtered by 'childTest'
      childTest - the predicate used to evaluate the direct child elements of 'parent'.
      Returns:
      'parentScope` which somewhere contains 'parent' with its children that matched 'childTest'
    • filterTagChildren

      public static org.openrewrite.xml.tree.Xml.Tag filterTagChildren(org.openrewrite.xml.tree.Xml.Tag parent, Predicate<org.openrewrite.xml.tree.Xml.Tag> childTest)
      Filter the children of a tag to only those that match the supplied predicate. Non-tag children, such as comments, are untouched.
      Parameters:
      parent - the tag whose direct child elements are to be filtered by 'childTest'
      childTest - the predicate used to evaluate the direct child elements of 'parent'.
      Returns:
      'parent' with its children that matched 'childTest'
    • filterTagChildren

      public static org.openrewrite.xml.tree.Xml.Tag filterTagChildren(org.openrewrite.xml.tree.Xml.Tag parentScope, org.openrewrite.xml.tree.Xml.Tag parent, Predicate<org.openrewrite.xml.tree.Xml.Tag> childTest)
      Filter the children of a tag to only those that match the supplied predicate. Non-tag children, such as comments, are untouched.
      Parameters:
      parentScope - a tag which contains 'parent' as a direct or transitive child element.
      parent - the tag whose direct child elements are to be filtered by 'childTest'
      childTest - the predicate used to evaluate the direct child elements of 'parent'.
      Returns:
      'parentScope` which somewhere contains 'parent' with its children that matched 'childTest'