Class RawTextElement<T extends RawTextElement<T>>

java.lang.Object
com.oorian.html.Element<T>
com.oorian.html.RawTextElement<T>
Type Parameters:
T - the concrete subclass type for fluent method chaining
Direct Known Subclasses:
Style, Title

public abstract class RawTextElement<T extends RawTextElement<T>> extends Element<T>
Base class for HTML elements that contain only text content, not arbitrary child elements.

This class provides setText(String) and addText(String) methods for managing text content. It is intended for elements like <rp> and <rt> whose content model is limited to phrasing content / text.

Since:
2007
Version:
1.0
Author:
Marvin P. Warble Jr.
See Also:
  • Constructor Details

    • RawTextElement

      public RawTextElement(String tagName)
      Constructs a new RawTextElement with the specified tag name.
      Parameters:
      tagName - the HTML tag name for this element
    • RawTextElement

      public RawTextElement(String tagName, boolean closed)
      Constructs a new RawTextElement with the specified tag name and closing behavior.
      Parameters:
      tagName - the HTML tag name for this element
      closed - true if this element has a closing tag, false for self-closing
  • Method Details

    • setText

      public void setText(String text)
      Sets the text content of this element, replacing any existing content.
      Overrides:
      setText in class Element<T extends RawTextElement<T>>
      Parameters:
      text - the text content to set
    • addText

      public void addText(String text)
      Appends text content to this element.
      Overrides:
      addText in class Element<T extends RawTextElement<T>>
      Parameters:
      text - the text content to append
    • addText

      public void addText(Text text)
      Appends a Text element to this element.
      Overrides:
      addText in class Element<T extends RawTextElement<T>>
      Parameters:
      text - the Text element to append