Class Editor.EditorElementBuilder
java.lang.Object
eu.maveniverse.domtrip.Editor.EditorElementBuilder
- Enclosing class:
Editor
Builder for creating and configuring elements within the Editor context.
This builder integrates with the Editor's whitespace management and automatically adds the created element to the specified parent.
-
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds and adds the element to the document.Makes this element self-closing.to(ContainerNode parent) Sets the parent node for this element.withAttribute(QName qname, String value) Adds an attribute to this element using a QName.withAttribute(String name, String value) Adds an attribute to this element.withAttributes(Map<String, String> attributes) Adds multiple attributes to this element.withQNameAttributes(Map<QName, String> qnameAttributes) Adds multiple attributes to this element using QNames.Sets text content for this element.
-
Method Details
-
to
Sets the parent node for this element.- Parameters:
parent- the parent node- Returns:
- this builder for method chaining
-
withText
Sets text content for this element.- Parameters:
content- the text content- Returns:
- this builder for method chaining
-
withAttribute
Adds an attribute to this element.- Parameters:
name- the attribute namevalue- the attribute value- Returns:
- this builder for method chaining
-
withAttribute
Adds an attribute to this element using a QName.- Parameters:
qname- the attribute QNamevalue- the attribute value- Returns:
- this builder for method chaining
-
withAttributes
Adds multiple attributes to this element.- Parameters:
attributes- a map of attribute names to values- Returns:
- this builder for method chaining
-
withQNameAttributes
Adds multiple attributes to this element using QNames.- Parameters:
qnameAttributes- a map of attribute QNames to values- Returns:
- this builder for method chaining
-
selfClosing
Makes this element self-closing.- Returns:
- this builder for method chaining
-
build
Builds and adds the element to the document.- Returns:
- the created and added element
- Throws:
DomTripException- if the element cannot be added
-