Package org.openrewrite.xml
Class AddToTagVisitor<P>
java.lang.Object
org.openrewrite.TreeVisitor<Xml,P>
org.openrewrite.xml.XmlVisitor<P>
org.openrewrite.xml.AddToTagVisitor<P>
-
Constructor Summary
ConstructorsConstructorDescriptionAddToTagVisitor(Xml.Tag scope, Xml.Tag tagToAdd) AddToTagVisitor(Xml.Tag scope, Xml.Tag tagToAdd, @Nullable Comparator<Content> tagComparator) -
Method Summary
Methods inherited from class org.openrewrite.xml.XmlVisitor
autoFormat, autoFormat, autoFormat, getLanguage, isAcceptable, maybeAutoFormat, maybeAutoFormat, maybeAutoFormat, visitAttribute, visitCharData, visitComment, visitDocTypeDecl, visitDocument, visitElement, visitIdent, visitJspDirective, visitProcessingInstruction, visitProlog, visitXmlDeclMethods 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
-
Constructor Details
-
AddToTagVisitor
-
AddToTagVisitor
public AddToTagVisitor(Xml.Tag scope, Xml.Tag tagToAdd, @Nullable @Nullable Comparator<Content> tagComparator)
-
-
Method Details
-
visitTag
- Overrides:
visitTagin classXmlVisitor<P>
-
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 childrennewChild- 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 childrennewChild- 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
-