com.sun.syndication.feed.synd

Class SyndFeedImpl

public class SyndFeedImpl extends Object implements Serializable, SyndFeed

Bean for all types of feeds.

It handles all RSS versions and Atom 0.3, it normalizes all info, it may lose information.

Author: Alejandro Abdelnur

Field Summary
static SetCONVENIENCE_PROPERTIES
Unmodifiable Set containing the convenience properties of this class.
static ConvertersCONVERTERS
static CopyFromHelperCOPY_FROM_HELPER
static SetIGNORE_PROPERTIES
List_authors
List_contributors
SyndContent_description
String_encoding
List_entries
String_feedType
List_foreignMarkup
SyndImage_image
String_link
List_links
List_modules
ObjectBean_objBean
SyndContent_title
String_uri
Constructor Summary
protected SyndFeedImpl(Class beanClass, Set convenienceProperties)
For implementations extending SyndFeedImpl to be able to use the ObjectBean functionality with extended interfaces.
SyndFeedImpl()
Default constructor.
SyndFeedImpl(WireFeed feed)
Creates a SyndFeedImpl and populates all its properties out of the given RSS Channel or Atom Feed properties.
Method Summary
Objectclone()
Creates a deep 'bean' clone of the object.
voidcopyFrom(Object obj)
WireFeedcreateWireFeed()
Creates a real feed containing the information of the SyndFeedImpl.
WireFeedcreateWireFeed(String feedType)
Creates a real feed containing the information of the SyndFeedImpl.
booleanequals(Object other)
Indicates whether some other object is "equal to" this one as defined by the Object equals() method.
StringgetAuthor()
Returns the feed author.
ListgetAuthors()
ListgetCategories()
Returns the feed categories.
ListgetContributors()
StringgetCopyright()
Returns the feed copyright.
DCModulegetDCModule()
Returns the Dublin Core module of the feed.
StringgetDescription()
Returns the feed description.
SyndContentgetDescriptionEx()
Returns the feed description as a text construct.
StringgetEncoding()
Returns the charset encoding of a the feed.
ListgetEntries()
Returns the feed entries.
StringgetFeedType()
Returns the wire feed type the feed had/will-have when coverted from/to a WireFeed.
ObjectgetForeignMarkup()
Returns foreign markup found at channel level.
SyndImagegetImage()
Returns the feed image.
ClassgetInterface()
StringgetLanguage()
Returns the feed language.
StringgetLink()
Returns the feed link.
ListgetLinks()
Returns the links

ModulegetModule(String uri)
Returns the module identified by a given URI.
ListgetModules()
Returns the feed modules.
DategetPublishedDate()
Returns the feed published date.
ListgetSupportedFeedTypes()
Returns the real feed types the SyndFeedImpl supports when converting from and to.
StringgetTitle()
Returns the feed title.
SyndContentgetTitleEx()
Returns the feed title as a text construct.
StringgetUri()
Returns the feed URI.
inthashCode()
Returns a hashcode value for the object.
voidsetAuthor(String author)
Sets the feed author.
voidsetAuthors(List authors)
voidsetCategories(List categories)
Sets the feed categories.
voidsetContributors(List contributors)
voidsetCopyright(String copyright)
Sets the feed copyright.
voidsetDescription(String description)
Sets the feed description.
voidsetDescriptionEx(SyndContent description)
Sets the feed description as a text construct.
voidsetEncoding(String encoding)
Sets the charset encoding of a the feed.
voidsetEntries(List entries)
Sets the feed entries.
voidsetFeedType(String feedType)
Sets the wire feed type the feed will-have when coverted to a WireFeed.
voidsetForeignMarkup(Object foreignMarkup)
Sets foreign markup found at channel level.
voidsetImage(SyndImage image)
Sets the feed image.
voidsetLanguage(String language)
Sets the feed language.
voidsetLink(String link)
Sets the feed link.
voidsetLinks(List links)
Set the links

voidsetModules(List modules)
Sets the feed modules.
voidsetPublishedDate(Date publishedDate)
Sets the feed published date.
voidsetTitle(String title)
Sets the feed title.
voidsetTitleEx(SyndContent title)
Sets the feed title as a text construct.
voidsetUri(String uri)
Sets the feed URI.
StringtoString()
Returns the String representation for the object.

Field Detail

CONVENIENCE_PROPERTIES

public static final Set CONVENIENCE_PROPERTIES
Unmodifiable Set containing the convenience properties of this class.

Convenience properties are mapped to Modules, for cloning the convenience properties can be ignored as the will be copied as part of the module cloning.

CONVERTERS

private static final Converters CONVERTERS

COPY_FROM_HELPER

private static final CopyFromHelper COPY_FROM_HELPER

IGNORE_PROPERTIES

private static final Set IGNORE_PROPERTIES

_authors

private List _authors

_contributors

private List _contributors

_description

private SyndContent _description

_encoding

private String _encoding

_entries

private List _entries

_feedType

private String _feedType

_foreignMarkup

private List _foreignMarkup

_image

private SyndImage _image

_link

private String _link

_links

private List _links

_modules

private List _modules

_objBean

private ObjectBean _objBean

_title

private SyndContent _title

_uri

private String _uri

Constructor Detail

SyndFeedImpl

protected SyndFeedImpl(Class beanClass, Set convenienceProperties)
For implementations extending SyndFeedImpl to be able to use the ObjectBean functionality with extended interfaces.

Parameters: beanClass convenienceProperties set containing the convenience properties of the SyndEntryImpl (the are ignored during cloning, check CloneableBean for details).

SyndFeedImpl

public SyndFeedImpl()
Default constructor. All properties are set to null.

SyndFeedImpl

public SyndFeedImpl(WireFeed feed)
Creates a SyndFeedImpl and populates all its properties out of the given RSS Channel or Atom Feed properties.

Parameters: feed the RSS Channel or the Atom Feed to populate the properties from.

Method Detail

clone

public Object clone()
Creates a deep 'bean' clone of the object.

Returns: a clone of the object.

Throws: CloneNotSupportedException thrown if an element of the object cannot be cloned.

copyFrom

public void copyFrom(Object obj)

createWireFeed

public WireFeed createWireFeed()
Creates a real feed containing the information of the SyndFeedImpl.

The feed type of the created WireFeed is taken from the SyndFeedImpl feedType property.

Returns: the real feed.

createWireFeed

public WireFeed createWireFeed(String feedType)
Creates a real feed containing the information of the SyndFeedImpl.

Parameters: feedType the feed type for the WireFeed to be created.

Returns: the real feed.

equals

public boolean equals(Object other)
Indicates whether some other object is "equal to" this one as defined by the Object equals() method.

Parameters: other he reference object with which to compare.

Returns: true if 'this' object is equal to the 'other' object.

getAuthor

public String getAuthor()
Returns the feed author.

This method is a convenience method, it maps to the Dublin Core module creator.

Returns: the feed author, null if none.

getAuthors

public List getAuthors()

getCategories

public List getCategories()
Returns the feed categories.

This method is a convenience method, it maps to the Dublin Core module subjects.

Returns: a list of SyndCategoryImpl elements with the feed categories, an empty list if none.

getContributors

public List getContributors()

getCopyright

public String getCopyright()
Returns the feed copyright.

This method is a convenience method, it maps to the Dublin Core module rights.

Returns: the feed copyright, null if none.

getDCModule

private DCModule getDCModule()
Returns the Dublin Core module of the feed.

Returns: the DC module, it's never null

getDescription

public String getDescription()
Returns the feed description.

Returns: the feed description, null if none.

getDescriptionEx

public SyndContent getDescriptionEx()
Returns the feed description as a text construct.

Returns: the feed description, null if none.

getEncoding

public String getEncoding()
Returns the charset encoding of a the feed. This is not set by Rome parsers.

Returns: the charset encoding of the feed.

getEntries

public List getEntries()
Returns the feed entries.

Returns: a list of SyndEntryImpl elements with the feed entries, an empty list if none.

getFeedType

public String getFeedType()
Returns the wire feed type the feed had/will-have when coverted from/to a WireFeed.

Returns: the feed type, null if none.

getForeignMarkup

public Object getForeignMarkup()
Returns foreign markup found at channel level.

Returns: Opaque object to discourage use

getImage

public SyndImage getImage()
Returns the feed image.

Returns: the feed image, null if none.

getInterface

public Class getInterface()

getLanguage

public String getLanguage()
Returns the feed language.

This method is a convenience method, it maps to the Dublin Core module language.

Returns: the feed language, null if none.

getLink

public String getLink()
Returns the feed link.

Note: The URI is the unique identifier, in the RSS 2.0/atom case this is the GUID, for RSS 1.0 this is the URI attribute of the item. The Link is the URL that the item is accessible under, the URI is the permanent identifier which the aggregator should use to reference this item. Often the URI will use some standardized identifier scheme such as DOI's so that items can be identified even if they appear in multiple feeds with different "links" (they might be on different hosting platforms but be the same item). Also, though rare, there could be multiple items with the same link but a different URI and associated metadata which need to be treated as distinct entities. In the RSS 1.0 case the URI must be a valid RDF URI reference.

Returns: the feed link, null if none.

getLinks

public List getLinks()
Returns the links

Returns: Returns the links.

getModule

public Module getModule(String uri)
Returns the module identified by a given URI.

Parameters: uri the URI of the ModuleImpl.

Returns: The module with the given URI, null if none.

getModules

public List getModules()
Returns the feed modules.

Returns: a list of ModuleImpl elements with the feed modules, an empty list if none.

getPublishedDate

public Date getPublishedDate()
Returns the feed published date.

This method is a convenience method, it maps to the Dublin Core module date.

Returns: the feed published date, null if none.

getSupportedFeedTypes

public List getSupportedFeedTypes()
Returns the real feed types the SyndFeedImpl supports when converting from and to.

Returns: the real feed type supported.

getTitle

public String getTitle()
Returns the feed title.

Returns: the feed title, null if none.

getTitleEx

public SyndContent getTitleEx()
Returns the feed title as a text construct.

Returns: the feed title, null if none.

getUri

public String getUri()
Returns the feed URI.

How the feed URI maps to a concrete feed type (RSS or Atom) depends on the concrete feed type. This is explained in detail in Rome documentation, Feed and entry URI mapping.

The returned URI is a normalized URI as specified in RFC 2396bis.

Note: The URI is the unique identifier, in the RSS 2.0/atom case this is the GUID, for RSS 1.0 this is the URI attribute of the item. The Link is the URL that the item is accessible under, the URI is the permanent identifier which the aggregator should use to reference this item. Often the URI will use some standardized identifier scheme such as DOI's so that items can be identified even if they appear in multiple feeds with different "links" (they might be on different hosting platforms but be the same item). Also, though rare, there could be multiple items with the same link but a different URI and associated metadata which need to be treated as distinct entities. In the RSS 1.0 case the URI must be a valid RDF URI reference.

Returns: the feed URI, null if none.

hashCode

public int hashCode()
Returns a hashcode value for the object.

It follows the contract defined by the Object hashCode() method.

Returns: the hashcode of the bean object.

setAuthor

public void setAuthor(String author)
Sets the feed author.

This method is a convenience method, it maps to the Dublin Core module creator.

Parameters: author the feed author to set, null if none.

setAuthors

public void setAuthors(List authors)

setCategories

public void setCategories(List categories)
Sets the feed categories.

This method is a convenience method, it maps to the Dublin Core module subjects.

Parameters: categories the list of SyndCategoryImpl elements with the feed categories to set, an empty list or null if none.

setContributors

public void setContributors(List contributors)

setCopyright

public void setCopyright(String copyright)
Sets the feed copyright.

This method is a convenience method, it maps to the Dublin Core module rights.

Parameters: copyright the feed copyright to set, null if none.

setDescription

public void setDescription(String description)
Sets the feed description.

Parameters: description the feed description to set, null if none.

setDescriptionEx

public void setDescriptionEx(SyndContent description)
Sets the feed description as a text construct.

Parameters: description the feed description to set, null if none.

setEncoding

public void setEncoding(String encoding)
Sets the charset encoding of a the feed. This is not set by Rome parsers.

Parameters: encoding the charset encoding of the feed.

setEntries

public void setEntries(List entries)
Sets the feed entries.

Parameters: entries the list of SyndEntryImpl elements with the feed entries to set, an empty list or null if none.

setFeedType

public void setFeedType(String feedType)
Sets the wire feed type the feed will-have when coverted to a WireFeed.

Parameters: feedType the feed type to set, null if none.

setForeignMarkup

public void setForeignMarkup(Object foreignMarkup)
Sets foreign markup found at channel level.

Parameters: foreignMarkup Opaque object to discourage use

setImage

public void setImage(SyndImage image)
Sets the feed image.

Parameters: image the feed image to set, null if none.

setLanguage

public void setLanguage(String language)
Sets the feed language.

This method is a convenience method, it maps to the Dublin Core module language.

Parameters: language the feed language to set, null if none.

setLink

public void setLink(String link)
Sets the feed link.

Note: The URI is the unique identifier, in the RSS 2.0/atom case this is the GUID, for RSS 1.0 this is the URI attribute of the item. The Link is the URL that the item is accessible under, the URI is the permanent identifier which the aggregator should use to reference this item. Often the URI will use some standardized identifier scheme such as DOI's so that items can be identified even if they appear in multiple feeds with different "links" (they might be on different hosting platforms but be the same item). Also, though rare, there could be multiple items with the same link but a different URI and associated metadata which need to be treated as distinct entities. In the RSS 1.0 case the URI must be a valid RDF URI reference.

Parameters: link the feed link to set, null if none.

setLinks

public void setLinks(List links)
Set the links

Parameters: links The links to set.

setModules

public void setModules(List modules)
Sets the feed modules.

Parameters: modules the list of ModuleImpl elements with the feed modules to set, an empty list or null if none.

setPublishedDate

public void setPublishedDate(Date publishedDate)
Sets the feed published date.

This method is a convenience method, it maps to the Dublin Core module date.

Parameters: publishedDate the feed published date to set, null if none.

setTitle

public void setTitle(String title)
Sets the feed title.

Parameters: title the feed title to set, null if none.

setTitleEx

public void setTitleEx(SyndContent title)
Sets the feed title as a text construct.

Parameters: title the feed title to set, null if none.

setUri

public void setUri(String uri)
Sets the feed URI.

How the feed URI maps to a concrete feed type (RSS or Atom) depends on the concrete feed type. This is explained in detail in Rome documentation, Feed and entry URI mapping.

Note: The URI is the unique identifier, in the RSS 2.0/atom case this is the GUID, for RSS 1.0 this is the URI attribute of the item. The Link is the URL that the item is accessible under, the URI is the permanent identifier which the aggregator should use to reference this item. Often the URI will use some standardized identifier scheme such as DOI's so that items can be identified even if they appear in multiple feeds with different "links" (they might be on different hosting platforms but be the same item). Also, though rare, there could be multiple items with the same link but a different URI and associated metadata which need to be treated as distinct entities. In the RSS 1.0 case the URI must be a valid RDF URI reference.

Parameters: uri the feed URI to set, null if none.

toString

public String toString()
Returns the String representation for the object.

Returns: String representation for the object.

Copyright © Sun Microsystems. All Rights Reserved.