Class Common

java.lang.Object
org.apache.juneau.bean.atom.Common
Direct Known Subclasses:
Category, CommonEntry, Generator, Icon, Id, Link, Logo, Person, Text

public abstract class Common extends Object
Base class for all Atom elements, providing common attributes.

This abstract class defines attributes that can appear on any Atom element. Per RFC 4287, all Atom elements may have xml:base and xml:lang attributes for managing URIs and language context.

Common attributes:

  • xml:base - Establishes a base URI for resolving relative references
  • xml:lang - Indicates the natural language of the element's content

This class is extended by all Atom bean classes (Feed, Entry, Link, Person, Category, Text, etc.).

Schema

atomCommonAttributes = attribute xml:base { atomUri }?, attribute xml:lang { atomLanguageTag }?, undefinedAttribute*

Examples:

// Set base URI for relative link resolution Feed feed = new Feed(...) .setBase("http://example.org/"); // Set language Text title = new Text("text") .setText("My Feed") .setLang("en");

Specification:

Represents atomCommonAttributes in the RFC 4287 - Section 2 specification.

See Also:
  • Constructor Details

  • Method Details

    • getBase

      @Xml(prefix="xml", format=ATTR) public URI getBase()
      Bean property getter: base.

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

      This attribute, defined by XML Base, establishes a base URI for resolving any relative references within the scope of this element. This is particularly useful when aggregating content from multiple sources.

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

      public Common setBase(Object value)
      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/");

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

      @Xml(prefix="xml", format=ATTR) public String getLang()
      Bean property getter: lang.

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

      The language tag should be a language identifier as defined by RFC 3066. This attribute is inherited by child elements, so it need only be specified on the highest-level element where it applies.

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

      public Common setLang(String value)
      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");

      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.
    • toString

      public String toString()
      Overrides:
      toString in class Object