Class Element<T extends Element<T>>

java.lang.Object
org.opentest4j.reporting.events.api.Element<T>
Type Parameters:
T - element type
All Implemented Interfaces:
Appendable<T>
Direct Known Subclasses:
ChildElement, Events

public class Element<T extends Element<T>> extends Object implements Appendable<T>
Base class for elements.
  • Constructor Details

    • Element

      public Element(Context context, org.opentest4j.reporting.schema.QualifiedName qualifiedName)
      Create an instance with the supplied context and qualified name.
      Parameters:
      context - the context of this instance
      qualifiedName - the qualified name of this instance
  • Method Details

    • withContent

      public Element<T> withContent(String value)
      Add text content to this element.
      Parameters:
      value - the text content
      Returns:
      this element
    • withCDataSection

      public Element<T> withCDataSection(String value)
      Add a CDATA section to this element.
      Parameters:
      value - the content of the CDATA section
      Returns:
      this element
    • withAttribute

      public Element<T> withAttribute(org.opentest4j.reporting.schema.QualifiedName qualifiedName, String value)
      Add an attribute to this element.
      Parameters:
      qualifiedName - the qualified name of the attribute
      value - the attribute value
      Returns:
      this element
    • append

      public <C extends ChildElement<T, ? super C>> Appendable<T> append(Factory<C> creator, Consumer<? super C> configurer)
      Description copied from interface: Appendable
      Append the child element created by the supplied factory configured by the supplied consumer.
      Specified by:
      append in interface Appendable<T extends Element<T>>
      Type Parameters:
      C - child element type
      Parameters:
      creator - child element factory
      configurer - child element configurer
      Returns:
      self reference to allow method chaining
    • toString

      public String toString()
      Overrides:
      toString in class Object