Top Description Fields Constructors Methods
org.opentest4j.reporting.events.api

public Class Element<T extends Element<T>>

extends Object
implements Appendable<T extends Element<T>>
Class Inheritance
All Implemented Interfaces
org.opentest4j.reporting.events.api.Appendable
Known Direct Subclasses
org.opentest4j.reporting.events.root.Events, org.opentest4j.reporting.events.api.ChildElement
Annotations
@API
status:EXPERIMENTAL
since:0.1.0
Type Parameters
<T>
element type
Imports
org.apiguardian.api.API, org.opentest4j.reporting.schema.Namespace, .QualifiedName, org.w3c.dom.Attr, .Document, java.util.UUID, java.util.function.Consumer, java.util.regex.Pattern

Base class for elements.
Since
0.1.0

Field Summary

Modifier and TypeField and Description
private static final Pattern
pack-priv static final String
private final Context
pack-priv final Element
private final Namespace

Constructor Summary

AccessConstructor and Description
public
Element(Context
the context of this instance
context
,
QualifiedName
the qualified name of this instance
qualifiedName
)

Create an instance with the supplied context and qualified name.

Method Summary

Modifier and TypeMethod and Description
public <C extends ChildElement<T, ? super C>> Appendable<T>
append(Factory<C>
child element factory
creator
,
Consumer<? super C>
child element configurer
configurer
)

Implements org.opentest4j.reporting.events.api.Appendable.append.

Append the child element created by the supplied factory configured by the supplied consumer.

private Attr
createAttr(QualifiedName qualifiedName)

private Document
pack-priv Element
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

public Element<T>

Returns:

this element
withAttribute
(QualifiedName
the qualified name of the attribute
qualifiedName
,
String
the attribute value
value
)

Add an attribute to this element.

public Element<T>

Returns:

this element
withCDataSection
(String
the content of the CDATA section
value
)

Add a CDATA section to this element.

public Element<T>

Returns:

this element
withContent
(String
the text content
value
)

Add text content to this element.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

CDATA_SPLIT_PATTERNback to summary
private static final Pattern CDATA_SPLIT_PATTERN
CDATA_WORKAROUND_COMMENTback to summary
pack-priv static final String CDATA_WORKAROUND_COMMENT
contextback to summary
private final Context context
domElementback to summary
pack-priv final Element domElement
namespaceback to summary
private final Namespace namespace

Constructor Detail

Elementback to summary
public Element(Context context, QualifiedName qualifiedName)

Create an instance with the supplied context and qualified name.

Parameters
context:Context

the context of this instance

qualifiedName:QualifiedName

the qualified name of this instance

Method Detail

appendback to summary
public <C extends ChildElement<T, ? super C>> Appendable<T> append(Factory<C> creator, Consumer<? super C> configurer)

Implements org.opentest4j.reporting.events.api.Appendable.append.

Doc from org.opentest4j.reporting.events.api.Appendable.append.

Append the child element created by the supplied factory configured by the supplied consumer.

Parameters
<C>
child element type
creator:Factory<C>

child element factory

configurer:Consumer<? super C>

child element configurer

Returns:Appendable<T>

self reference to allow method chaining

Annotations
@Override
createAttrback to summary
private Attr createAttr(QualifiedName qualifiedName)
documentback to summary
private Document document()
getDomElementback to summary
pack-priv Element getDomElement()
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

Annotations
@Override
withAttributeback to summary
public Element<T> withAttribute(QualifiedName qualifiedName, String value)

Add an attribute to this element.

Parameters
qualifiedName:QualifiedName

the qualified name of the attribute

value:String

the attribute value

Returns:Element<T>

this element

withCDataSectionback to summary
public Element<T> withCDataSection(String value)

Add a CDATA section to this element.

Parameters
value:String

the content of the CDATA section

Returns:Element<T>

this element

Annotations
@SuppressWarnings:UnusedReturnValue
withContentback to summary
public Element<T> withContent(String value)

Add text content to this element.

Parameters
value:String

the text content

Returns:Element<T>

this element