Interface ApiElement<E extends ApiElement<?>>

All Superinterfaces:
AutoCloseable, Closeable
All Known Implementing Classes:
AbstractElement, AbstractHtmlElement, Element, HtmlElement, XmlBuilder, XmlElement, XmlModel

public interface ApiElement<E extends ApiElement<?>> extends Closeable
An element model API. The XmlElement class implements the Closeable implementation for an optional highlighting the tree structure in the source code.
Since:
1.86
Author:
Pavel Ponec
  • Method Details

    • getName

      @NotNull @NotNull String getName()
      Get an element name
    • addElement

      @NotNull E addElement(@NotNull @NotNull String name)
      Create a new ApiElement for a required name and add it to children.
      Parameters:
      name - A name of the new XmlElement is required.
      Returns:
      The new XmlElement!
    • setAttribute

      @NotNull E setAttribute(@NotNull @NotNull String name, @Nullable @Nullable Object value)
      Set an attribute
      Parameters:
      name - Required element name
      value - The null value is silently ignored. Formatting is performed by the AbstractWriter.writeValue(Object, ApiElement, String) method, where the default implementation calls a toString() only.
      Returns:
      The original element
    • setAttrib

      @Deprecated @NotNull default E setAttrib(@NotNull @NotNull String name, @Nullable @Nullable Object value)
      Deprecated.
    • addText

      @NotNull E addText(@Nullable @Nullable Object value)
      Add a text and escape special character
      Parameters:
      value - The null value is allowed. Formatting is performed by the AbstractWriter.writeValue(Object, ApiElement, String) } method, where the default implementation calls a toString() only.
      Returns:
      This instance
    • addTextTemplated

      @NotNull E addTextTemplated(@Nullable @Nullable CharSequence template, @NotNull @NotNull Object... values)
      Message template
      Parameters:
      template - Message template where parameters are marked by the {} symbol
      values - argument values
      Returns:
      The original builder
    • addRawText

      @NotNull E addRawText(@Nullable @Nullable Object value)
      Add an native text with no escaped characters, for example: XML code, JavaScript, CSS styles
      Parameters:
      value - The null value is ignored.
      Returns:
      This instance
    • addComment

      @NotNull E addComment(@Nullable @Nullable CharSequence comment)
      Add a comment text. The CDATA structure isn't really for HTML at all.
      Parameters:
      comment - A comment text must not contain a string --> .
      Returns:
      This instance
    • addCDATA

      @NotNull E addCDATA(@Nullable @Nullable CharSequence charData)
      Add a character data in CDATA format to XML only. The CDATA structure isn't really for HTML at all.
      Parameters:
      charData - A text including the final DATA sequence. An empty argument is ignored.
      Returns:
      This instance
    • close

      void close()
      Close the element
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable