Package org.openrewrite.xml
Class FilterTagChildrenVisitor<T>
- java.lang.Object
-
- org.openrewrite.TreeVisitor<Xml,P>
-
- org.openrewrite.xml.XmlVisitor<T>
-
- org.openrewrite.xml.FilterTagChildrenVisitor<T>
-
public class FilterTagChildrenVisitor<T> extends XmlVisitor<T>
Filter the children to only those matching the supplied predicate.
-
-
Constructor Summary
Constructors Constructor Description FilterTagChildrenVisitor()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Xml.TagfilterChildren(Xml.Tag parent, java.util.function.Predicate<Content> childTest)Filter the children of a tag to only those that match the supplied predicate.static Xml.TagfilterChildren(Xml.Tag parentScope, Xml.Tag parent, java.util.function.Predicate<Content> childTest)Filter the children of a tag to only those that match the supplied predicate.static Xml.TagfilterTagChildren(Xml.Tag parent, java.util.function.Predicate<Xml.Tag> childTest)Filter the children of a tag to only those that match the supplied predicate.static Xml.TagfilterTagChildren(Xml.Tag parentScope, Xml.Tag parent, java.util.function.Predicate<Xml.Tag> childTest)Filter the children of a tag to only those that match the supplied predicate.XmlvisitTag(Xml.Tag tag, T ctx)-
Methods inherited from class org.openrewrite.xml.XmlVisitor
getLanguage, isAcceptable, visitAttribute, visitCharData, visitComment, visitDocTypeDecl, visitDocument, visitElement, visitIdent, visitProcessingInstruction, visitProlog, visitXmlDecl
-
-
-
-
Method Detail
-
filterChildren
public static Xml.Tag filterChildren(Xml.Tag parent, java.util.function.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 Xml.Tag filterChildren(Xml.Tag parentScope, Xml.Tag parent, java.util.function.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 Xml.Tag filterTagChildren(Xml.Tag parent, java.util.function.Predicate<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 Xml.Tag filterTagChildren(Xml.Tag parentScope, Xml.Tag parent, java.util.function.Predicate<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'
-
-