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>
Filter the children to only those matching the supplied predicate.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Xml.TagfilterChildren(Xml.Tag parent, 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, Predicate<Content> childTest) Filter the children of a tag to only those that match the supplied predicate.static Xml.TagfilterTagChildren(Xml.Tag parent, 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, Predicate<Xml.Tag> childTest) Filter the children of a tag to only those that match the supplied predicate.Methods inherited from class org.openrewrite.xml.XmlVisitor
autoFormat, autoFormat, autoFormat, getLanguage, isAcceptable, maybeAutoFormat, maybeAutoFormat, maybeAutoFormat, visitAttribute, visitCharData, visitComment, visitDocTypeDecl, visitDocument, visitElement, visitIdent, visitProcessingInstruction, visitProlog, visitXmlDeclMethods inherited from class org.openrewrite.TreeVisitor
adapt, collect, collect, defaultValue, describeLocation, doAfterVisit, doAfterVisit, getAfterVisit, getCursor, isAdaptableTo, noop, postVisit, preVisit, reduce, reduce, reduce, setCursor, visit, visit, visit, visitAndCast, visitAndCast, visitMarker, visitMarkers, visitNonNull, visitNonNull, visitSourceFile
-
Field Details
-
scope
-
childTest
-
-
Constructor Details
-
FilterTagChildrenVisitor
public FilterTagChildrenVisitor()
-
-
Method Details
-
visitTag
- Overrides:
visitTagin classXmlVisitor<T>
-
filterChildren
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, 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
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, 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'
-