Package eu.maveniverse.domtrip
Class Editor.EditorElementBuilder
- java.lang.Object
-
- eu.maveniverse.domtrip.Editor.EditorElementBuilder
-
- Enclosing class:
- Editor
public static class Editor.EditorElementBuilder extends java.lang.ObjectBuilder 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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Elementbuild()Builds and adds the element to the document.Editor.EditorElementBuilderselfClosing()Makes this element self-closing.Editor.EditorElementBuilderto(ContainerNode parent)Sets the parent node for this element.Editor.EditorElementBuilderwithAttribute(QName qname, java.lang.String value)Adds an attribute to this element using a QName.Editor.EditorElementBuilderwithAttribute(java.lang.String name, java.lang.String value)Adds an attribute to this element.Editor.EditorElementBuilderwithAttributes(java.util.Map<java.lang.String,java.lang.String> attributes)Adds multiple attributes to this element.Editor.EditorElementBuilderwithQNameAttributes(java.util.Map<QName,java.lang.String> qnameAttributes)Adds multiple attributes to this element using QNames.Editor.EditorElementBuilderwithText(java.lang.String content)Sets text content for this element.
-
-
-
Method Detail
-
to
public Editor.EditorElementBuilder to(ContainerNode parent)
Sets the parent node for this element.- Parameters:
parent- the parent node- Returns:
- this builder for method chaining
-
withText
public Editor.EditorElementBuilder withText(java.lang.String content)
Sets text content for this element.- Parameters:
content- the text content- Returns:
- this builder for method chaining
-
withAttribute
public Editor.EditorElementBuilder withAttribute(java.lang.String name, java.lang.String value)
Adds an attribute to this element.- Parameters:
name- the attribute namevalue- the attribute value- Returns:
- this builder for method chaining
-
withAttribute
public Editor.EditorElementBuilder withAttribute(QName qname, java.lang.String value)
Adds an attribute to this element using a QName.- Parameters:
qname- the attribute QNamevalue- the attribute value- Returns:
- this builder for method chaining
-
withAttributes
public Editor.EditorElementBuilder withAttributes(java.util.Map<java.lang.String,java.lang.String> attributes)
Adds multiple attributes to this element.- Parameters:
attributes- a map of attribute names to values- Returns:
- this builder for method chaining
-
withQNameAttributes
public Editor.EditorElementBuilder withQNameAttributes(java.util.Map<QName,java.lang.String> qnameAttributes)
Adds multiple attributes to this element using QNames.- Parameters:
qnameAttributes- a map of attribute QNames to values- Returns:
- this builder for method chaining
-
selfClosing
public Editor.EditorElementBuilder selfClosing()
Makes this element self-closing.- Returns:
- this builder for method chaining
-
build
public Element build() throws DomTripException
Builds and adds the element to the document.- Returns:
- the created and added element
- Throws:
DomTripException- if the element cannot be added
-
-