Class Text

java.lang.Object
org.apache.juneau.bean.atom.Common
org.apache.juneau.bean.atom.Text
Direct Known Subclasses:
Content

public class Text extends Common
Represents human-readable text in an Atom document.

Text constructs are used throughout Atom for elements that contain human-readable text such as titles, summaries, rights statements, and subtitles. They support three content types:

  • "text" - Plain text with no markup (default)
  • "html" - HTML markup, entity-escaped
  • "xhtml" - Well-formed XHTML in a div container

Text constructs are the base class for Content and are used directly for:

  • atom:title - Entry and feed titles
  • atom:subtitle - Feed subtitles
  • atom:summary - Entry summaries
  • atom:rights - Copyright and rights statements
Schema

atomTextConstruct = atomPlainTextConstruct | atomXHTMLTextConstruct atomPlainTextConstruct = atomCommonAttributes, attribute type { "text" | "html" }?, text atomXHTMLTextConstruct = atomCommonAttributes, attribute type { "xhtml" }, xhtmlDiv xhtmlDiv = element xhtml:div { (attribute * { text } | text | anyXHTML)* }

Examples:

// Plain text Text t1 = new Text("text") .setText("Plain text title"); // HTML (entity-escaped) Text t2 = new Text("html") .setText("Title with <em>emphasis</em>"); // XHTML Text t3 = new Text("xhtml") .setText("<div xmlns='http://www.w3.org/1999/xhtml'><p>XHTML title</p></div>");

Specification:

Represents an atomTextConstruct in the RFC 4287 - Section 3.1 specification.

See Also:
  • Constructor Details

    • Text

      public Text(String type)
      Normal content.
      Parameters:
      type - The content type of this content.
    • Text

      public Text()
      Bean constructor.
  • Method Details

    • getType

      Bean property getter: type.

      The content type of this content.

      Returns:
      The property value, or null if it is not set.
    • setType

      public Text setType(String value)
      Bean property setter: type.

      The content type of this content.

      Must be one of the following:

      • "text"
      • "html"
      • "xhtml"
      • null (defaults to "text")
      Parameters:
      value - The new value for this property.
      Can be null to unset the property.
      Returns:
      This object
    • getText

      Bean property getter: text.

      The content of this content.

      Returns:
      The property value, or null if it is not set.
    • setText

      public Text setText(String value)
      Bean property setter: text.

      The content of this content.

      Parameters:
      value - The new value for this property.
      Can be null to unset the property.
      Returns:
      This object
    • setBase

      public Text setBase(Object value)
      Description copied from class: Common
      Bean property setter: base.

      Sets the base URI for resolving relative URI references (xml:base attribute).

      The value can be of any of the following types: URI, URL, String. Strings must be valid URIs.

      Example:

      Feed feed = new Feed(...) .setBase("http://example.org/");

      Overrides:
      setBase in class Common
      Parameters:
      value - The new value for this property.
      Can be null to unset the property.
      Returns:
      This object.
    • setLang

      public Text setLang(String value)
      Description copied from class: Common
      Bean property setter: lang.

      Sets the natural language of the element's content (xml:lang attribute).

      Example:

      Text title = new Text("text") .setText("Mon Blog") .setLang("fr");

      Overrides:
      setLang in class Common
      Parameters:
      value - The new value for this property (e.g., "en", "fr", "de", "en-US").
      Can be null to unset the property.
      Returns:
      This object.