Class Id


@Bean(typeName="id") public class Id extends Common
Represents a permanent, universally unique identifier for a feed or entry.

The ID element provides a permanent, globally unique identifier for feeds and entries. IDs must never change, even if the resource is moved or its content is modified.

Requirements for IDs per RFC 4287:

  • Must be a valid IRI (Internationalized Resource Identifier)
  • Must be permanent - never changes
  • Must be unique - no two feeds or entries should share the same ID
  • Should be dereferenceable when possible (but not required)

Common ID formats:

  • Tag URI - tag:example.org,2024:entry-123
  • HTTP URL - http://example.org/posts/123
  • UUID URN - urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a
Schema

atomId = element atom:id { atomCommonAttributes, (atomUri) }

Examples:

// Tag URI (recommended) Id id1 = new Id("tag:example.org,2024:feed"); // HTTP URL Id id2 = new Id("http://example.org/posts/123"); // UUID URN Id id3 = new Id("urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a");

Specification:

Represents an atomId construct in the RFC 4287 - Section 4.2.6 specification.

See Also:
  • Constructor Details

    • Id

      public Id(String text)
      Normal constructor.
      Parameters:
      text - The id element contents.
    • Id

      public Id()
      Bean constructor.
  • Method Details

    • getText

      Bean property getter: text.

      The content of this identifier.

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

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

      The content of this identifier.

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

      public Id 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 Id 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.