Class Element<T extends 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 java.lang.Object
    implements Appendable<T>
    Base class for elements.
    • Constructor Summary

      Constructors 
      Constructor Description
      Element​(Context context, org.opentest4j.reporting.schema.QualifiedName qualifiedName)
      Create an instance with the supplied context and qualified name.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      <C extends ChildElement<T,​? super C>>
      Appendable<T>
      append​(Factory<C> creator, java.util.function.Consumer<? super C> configurer)
      Append the child element created by the supplied factory configured by the supplied consumer.
      java.lang.String toString()  
      Element<T> withAttribute​(org.opentest4j.reporting.schema.QualifiedName qualifiedName, java.lang.String value)
      Add an attribute to this element.
      Element<T> withCDataSection​(java.lang.String value)
      Add a CDATA section to this element.
      Element<T> withContent​(java.lang.String value)
      Add text content to this element.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface org.opentest4j.reporting.events.api.Appendable

        append
    • Constructor Detail

      • 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 Detail

      • withContent

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

        public Element<T> withCDataSection​(java.lang.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,
                                        java.lang.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,
                                                                                java.util.function.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 java.lang.String toString()
        Overrides:
        toString in class java.lang.Object