Class Feed


@Bean(typeName="feed") public class Feed extends CommonEntry
Represents a top-level Atom feed document.

An Atom feed is a Web resource that contains metadata and optionally a set of entries. Feeds are the top-level container element in Atom documents and act as a manifest of metadata and data associated with a collection of related resources.

The feed is the fundamental unit of syndication in Atom and is used to aggregate entries that share a common purpose, such as a blog, podcast channel, or news source.

Schema

atomFeed = element atom:feed { atomCommonAttributes, (atomAuthor* & atomCategory* & atomContributor* & atomGenerator? & atomIcon? & atomId & atomLink* & atomLogo? & atomRights? & atomSubtitle? & atomTitle & atomUpdated & extensionElement*), atomEntry* }

Required Elements:

Per RFC 4287, the following elements are required in a feed:

  • atom:id - A permanent, universally unique identifier for the feed.
  • atom:title - A human-readable title for the feed.
  • atom:updated - The most recent instant in time when the feed was modified.
Recommended Elements:

The following elements are recommended but not required:

  • atom:author - Authors of the feed (required if entries don't have authors).
  • atom:link - Links associated with the feed (should include a "self" link).
Example:

// Create a feed using fluent-style setters Feed feed = new Feed( "tag:example.org,2024:feed", "Example Feed", "2024-01-15T12:00:00Z" ) .setSubtitle("A sample Atom feed") .setLinks( new Link("self", "application/atom+xml", "http://example.org/feed.atom"), new Link("alternate", "text/html", "http://example.org") ) .setAuthors( new Person("John Doe").setEmail("john@example.org") ) .setEntries( new Entry("tag:example.org,2024:entry1", "First Post", "2024-01-15T12:00:00Z") .setSummary("This is the first post") ); // Serialize to ATOM/XML String atomXml = XmlSerializer.DEFAULT_SQ_READABLE.serialize(feed);

Specification:

Represents an atomFeed construct in the RFC 4287 - Section 4.1.1 specification.

See Also:
  • Constructor Details

    • Feed

      public Feed(Id id, Text title, Calendar updated)
      Normal constructor.
      Parameters:
      id - The feed identifier.
      title - The feed title.
      updated - The feed updated timestamp.
    • Feed

      public Feed(String id, String title, String updated)
      Normal constructor.
      Parameters:
      id - The feed identifier.
      title - The feed title.
      updated - The feed updated timestamp.
    • Feed

      public Feed()
      Bean constructor.
  • Method Details

    • getGenerator

      Bean property getter: generator.

      Identifies the software agent used to generate the feed.

      This is useful for debugging and analytics purposes, allowing consumers to identify the software responsible for producing the feed.

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

      public Feed setGenerator(Generator value)
      Bean property setter: generator.

      Identifies the software agent used to generate the feed.

      Example:

      Feed feed = new Feed(...) .setGenerator( new Generator("My Blog Software") .setUri("http://www.example.com/software") .setVersion("2.0") );

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

      public Icon getIcon()
      Bean property getter: icon.

      Identifies a small image that provides iconic visual identification for the feed.

      Icons should be square and small (typically 16x16 or similar). The image should have an aspect ratio of 1 (horizontal) to 1 (vertical).

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

      public Feed setIcon(Icon value)
      Bean property setter: icon.

      Identifies a small image that provides iconic visual identification for the feed.

      Example:

      Feed feed = new Feed(...) .setIcon(new Icon("http://example.org/icon.png"));

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

      public Logo getLogo()
      Bean property getter: logo.

      Identifies a larger image that provides visual identification for the feed.

      Logos should be twice as wide as they are tall (aspect ratio of 2:1).

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

      public Feed setLogo(Logo value)
      Bean property setter: logo.

      Identifies a larger image that provides visual identification for the feed.

      Example:

      Feed feed = new Feed(...) .setLogo(new Logo("http://example.org/logo.png"));

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

      public Text getSubtitle()
      Bean property getter: subtitle.

      Returns a human-readable description or subtitle for the feed.

      The subtitle provides additional context about the feed's purpose or content beyond what is conveyed in the title.

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

      public Feed setSubtitle(Text value)
      Bean property setter: subtitle.

      Sets a human-readable description or subtitle for the feed.

      Example:

      Feed feed = new Feed(...) .setSubtitle( new Text("html") .setText("A <em>comprehensive</em> guide to Atom feeds") );

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

      public Feed setSubtitle(String value)
      Bean property fluent setter: subtitle.

      Sets a human-readable description or subtitle for the feed as plain text.

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

      Bean property getter: entries.

      Returns the individual entries contained within this feed.

      Each entry represents a single item in the feed, such as a blog post, news article, podcast episode, or other discrete piece of content. Entries contain their own metadata including title, content, links, and timestamps.

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

      public Feed setEntries(Entry... value)
      Bean property setter: entries.

      Sets the individual entries contained within this feed.

      Example:

      Feed feed = new Feed(...) .setEntries( new Entry( "tag:example.org,2024:entry1", "First Post", "2024-01-15T12:00:00Z" ) .setContent( new Content("html") .setText("<p>This is the content</p>") ), new Entry( "tag:example.org,2024:entry2", "Second Post", "2024-01-16T12:00:00Z" ) );

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

      public Feed 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 CommonEntry
      Parameters:
      value - The new value for this property.
      Can be null to unset the property.
      Returns:
      This object.
    • setLang

      public Feed 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 CommonEntry
      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.
    • setAuthors

      public Feed setAuthors(Person... value)
      Description copied from class: CommonEntry
      Bean property setter: authors.

      The list of authors for this object.

      Overrides:
      setAuthors in class CommonEntry
      Parameters:
      value - The new value for this property.
      Can be null to unset the property.
      Returns:
      This object
    • setCategories

      public Feed setCategories(Category... value)
      Description copied from class: CommonEntry
      Bean property setter: categories.

      The list of categories of this object.

      Overrides:
      setCategories in class CommonEntry
      Parameters:
      value - The new value for this property.
      Can be null to unset the property.
      Returns:
      This object
    • setContributors

      public Feed setContributors(Person... value)
      Description copied from class: CommonEntry
      Bean property setter: contributors.

      The list of contributors of this object.

      Overrides:
      setContributors in class CommonEntry
      Parameters:
      value - The new value for this property.
      Can be null to unset the property.
      Returns:
      This object
    • setId

      public Feed setId(String value)
      Description copied from class: CommonEntry
      Bean property fluent setter: id.

      The ID of this object.

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

      public Feed setId(Id value)
      Description copied from class: CommonEntry
      Bean property setter: id.

      The ID of this object.

      Overrides:
      setId in class CommonEntry
      Parameters:
      value - The new value for this property.
      Can be null to unset the property.
      Returns:
      This object
    • setLinks

      public Feed setLinks(Link... value)
      Description copied from class: CommonEntry
      Bean property setter: links.

      The list of links of this object.

      Overrides:
      setLinks in class CommonEntry
      Parameters:
      value - The new value for this property.
      Can be null to unset the property.
      Returns:
      This object
    • setRights

      public Feed setRights(String value)
      Description copied from class: CommonEntry
      Bean property fluent setter: rights.

      The rights statement of this object.

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

      public Feed setRights(Text value)
      Description copied from class: CommonEntry
      Bean property setter: rights.

      The rights statement of this object.

      Overrides:
      setRights in class CommonEntry
      Parameters:
      value - The new value for this property.
      Can be null to unset the property.
      Returns:
      This object
    • setTitle

      public Feed setTitle(String value)
      Description copied from class: CommonEntry
      Bean property fluent setter: title.

      The title of this object.

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

      public Feed setTitle(Text value)
      Description copied from class: CommonEntry
      Bean property setter: title.

      The title of this object.

      Overrides:
      setTitle in class CommonEntry
      Parameters:
      value - The new value for this property.
      Can be null to unset the property.
      Returns:
      This object
    • setUpdated

      public Feed setUpdated(String value)
      Description copied from class: CommonEntry
      Bean property fluent setter: updated.

      The update timestamp of this object.

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

      public Feed setUpdated(Calendar value)
      Description copied from class: CommonEntry
      Bean property setter: updated.

      The update timestamp of this object.

      Overrides:
      setUpdated in class CommonEntry
      Parameters:
      value - The new value for this property.
      Can be null to unset the property.
      Returns:
      This object