Class SyndFeedImpl
- java.lang.Object
-
- com.rometools.rome.feed.synd.SyndFeedImpl
-
- All Implemented Interfaces:
CopyFrom,Extendable,SyndFeed,Serializable,Cloneable
public class SyndFeedImpl extends Object implements Serializable, SyndFeed
Bean for all types of feeds.It handles all RSS versions, Atom 0.3 and Atom 1.0, it normalizes all info, it may lose information.
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static Set<String>CONVENIENCE_PROPERTIESUnmodifiable Set containing the convenience properties of this class.
-
Constructor Summary
Constructors Modifier Constructor Description SyndFeedImpl()SyndFeedImpl(WireFeed feed)Creates a SyndFeedImpl and populates all its properties out of the given RSS Channel or Atom Feed properties.SyndFeedImpl(WireFeed feed, boolean preserveWireFeed)Creates a SyndFeedImpl and populates all its properties out of the given RSS Channel or Atom Feed properties, while optionally preserving the WireFeed for access via the orignalWireFeed() method.protectedSyndFeedImpl(Class<?> beanClass, Set<String> convenienceProperties)For implementations extending SyndFeedImpl to be able to use the ObjectBean functionality with extended interfaces.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Objectclone()Creates a deep 'bean' clone of the object.voidcopyFrom(CopyFrom obj)Copies all the properties of the given bean into this one.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.List<SyndPerson>getAuthors()Returns the feed authors.List<SyndCategory>getCategories()Returns the feed categories.List<SyndPerson>getContributors()Returns the feed author.StringgetCopyright()Returns the feed copyright.StringgetDescription()Returns the feed description.SyndContentgetDescriptionEx()Returns the feed description as a text construct.StringgetDocs()This tag should contain a URL that references a description of the channel.StringgetEncoding()Returns the charset encoding of a the feed.List<SyndEntry>getEntries()Returns the feed entries.StringgetFeedType()Returns the wire feed type the feed had/will-have when coverted from/to a WireFeed.List<org.jdom2.Element>getForeignMarkup()Returns foreign markup found at channel level.StringgetGenerator()A string indicating the program used to generate the channel.SyndImagegetIcon()Returns the feed icon.SyndImagegetImage()Returns the feed image.Class<SyndFeed>getInterface()Returns the interface the copyFrom works on.StringgetLanguage()Returns the feed language.StringgetLink()Returns the feed link.List<SyndLink>getLinks()Returns the linksStringgetManagingEditor()The email address of the managing editor of the site, the person to contact for editorial inquiries.ModulegetModule(String uri)Returns the module identified by a given URI.List<Module>getModules()Returns the feed modules.DategetPublishedDate()Returns the feed published date.StringgetStyleSheet()URL of XSL-Stylesheet.List<String>getSupportedFeedTypes()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.StringgetWebMaster()The email address of the webmaster for the site, the person to contact if there are technical problems with the channel.inthashCode()Returns a hashcode value for the object.booleanisPreservingWireFeed()WireFeedoriginalWireFeed()Returns the WireFeed this SyndFeed was created from.voidsetAuthor(String author)Sets the feed author.voidsetAuthors(List<SyndPerson> authors)Sets the feed authors.voidsetCategories(List<SyndCategory> categories)Sets the feed categories.voidsetContributors(List<SyndPerson> contributors)Sets the feed author.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.voidsetDocs(String docs)This tag should contain a URL that references a description of the channel.voidsetEncoding(String encoding)Sets the charset encoding of a the feed.voidsetEntries(List<SyndEntry> entries)Sets the feed entries.voidsetFeedType(String feedType)Sets the wire feed type the feed will-have when coverted to a WireFeed.voidsetForeignMarkup(List<org.jdom2.Element> foreignMarkup)Sets foreign markup found at channel level.voidsetGenerator(String generator)A string indicating the program used to generate the channel.voidsetIcon(SyndImage icon)Sets the feed icon.voidsetImage(SyndImage image)Sets the feed image.voidsetLanguage(String language)Sets the feed language.voidsetLink(String link)Sets the feed link.voidsetLinks(List<SyndLink> links)Set the linksvoidsetManagingEditor(String managingEditor)The email address of the managing editor of the site, the person to contact for editorial inquiries.voidsetModules(List<Module> modules)Sets the feed modules.voidsetPublishedDate(Date publishedDate)Sets the feed published date.voidsetStyleSheet(String styleSheet)URL of XSL-Stylesheet.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.voidsetWebMaster(String webMaster)The email address of the webmaster for the site, the person to contact if there are technical problems with the channel.StringtoString()Returns the String representation for the object.
-
-
-
Field Detail
-
CONVENIENCE_PROPERTIES
public static final Set<String> 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.
-
-
Constructor Detail
-
SyndFeedImpl
protected SyndFeedImpl(Class<?> beanClass, Set<String> 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()
-
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.
-
SyndFeedImpl
public SyndFeedImpl(WireFeed feed, boolean preserveWireFeed)
Creates a SyndFeedImpl and populates all its properties out of the given RSS Channel or Atom Feed properties, while optionally preserving the WireFeed for access via the orignalWireFeed() method.
-
-
Method Detail
-
getSupportedFeedTypes
public List<String> getSupportedFeedTypes()
Returns the real feed types the SyndFeedImpl supports when converting from and to.- Specified by:
getSupportedFeedTypesin interfaceSyndFeed- Returns:
- the real feed type supported.
-
clone
public Object clone() throws CloneNotSupportedException
Creates a deep 'bean' clone of the object.- Specified by:
clonein interfaceSyndFeed- Overrides:
clonein classObject- Returns:
- a clone of the object.
- Throws:
CloneNotSupportedException- thrown if an element of the object cannot be cloned.
-
equals
public boolean equals(Object other)
Indicates whether some other object is "equal to" this one as defined by the Object equals() method.
-
hashCode
public int hashCode()
Returns a hashcode value for the object.It follows the contract defined by the Object hashCode() method.
-
toString
public String toString()
Returns the String representation for the object.
-
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.
- Specified by:
createWireFeedin interfaceSyndFeed- Returns:
- the real feed.
-
createWireFeed
public WireFeed createWireFeed(String feedType)
Creates a real feed containing the information of the SyndFeedImpl.- Specified by:
createWireFeedin interfaceSyndFeed- Parameters:
feedType- the feed type for the WireFeed to be created.- Returns:
- the real feed.
-
originalWireFeed
public WireFeed originalWireFeed()
Returns the WireFeed this SyndFeed was created from. Will return null if the original feed is not stored or if this SyndFeed was not created from a WireFeed.
Note: The wire feed returned here will NOT contain any modifications done on this SyndFeed since it was created. That is in contrast to the createWireFeed method, which will reflect the current state of the SyndFeed- Specified by:
originalWireFeedin interfaceSyndFeed- Returns:
- The WireFeed this was created from, or null
-
getFeedType
public String getFeedType()
Returns the wire feed type the feed had/will-have when coverted from/to a WireFeed.- Specified by:
getFeedTypein interfaceSyndFeed- Returns:
- the feed type, null if none.
-
setFeedType
public void setFeedType(String feedType)
Sets the wire feed type the feed will-have when coverted to a WireFeed.- Specified by:
setFeedTypein interfaceSyndFeed- Parameters:
feedType- the feed type to set, null if none.
-
getEncoding
public String getEncoding()
Returns the charset encoding of a the feed. This is not set by Rome parsers.- Specified by:
getEncodingin interfaceSyndFeed- Returns:
- the charset encoding of the feed.
-
setEncoding
public void setEncoding(String encoding)
Sets the charset encoding of a the feed. This is not set by Rome parsers.- Specified by:
setEncodingin interfaceSyndFeed- Parameters:
encoding- the charset encoding of the feed.
-
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.
-
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.
-
getTitle
public String getTitle()
Returns the feed title.
-
setTitle
public void setTitle(String title)
Sets the feed title.
-
getTitleEx
public SyndContent getTitleEx()
Returns the feed title as a text construct.- Specified by:
getTitleExin interfaceSyndFeed- Returns:
- the feed title, null if none.
-
setTitleEx
public void setTitleEx(SyndContent title)
Sets the feed title as a text construct.- Specified by:
setTitleExin interfaceSyndFeed- Parameters:
title- the feed title to set, 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.
-
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.
-
getDescription
public String getDescription()
Returns the feed description.- Specified by:
getDescriptionin interfaceSyndFeed- Returns:
- the feed description, null if none.
-
setDescription
public void setDescription(String description)
Sets the feed description.- Specified by:
setDescriptionin interfaceSyndFeed- Parameters:
description- the feed description to set, null if none.
-
getDescriptionEx
public SyndContent getDescriptionEx()
Returns the feed description as a text construct.- Specified by:
getDescriptionExin interfaceSyndFeed- Returns:
- the feed description, null if none.
-
setDescriptionEx
public void setDescriptionEx(SyndContent description)
Sets the feed description as a text construct.- Specified by:
setDescriptionExin interfaceSyndFeed- Parameters:
description- the feed description to set, null 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.
- Specified by:
getPublishedDatein interfaceSyndFeed- Returns:
- the feed published date, 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.
- Specified by:
setPublishedDatein interfaceSyndFeed- Parameters:
publishedDate- the feed published date to set, null if none.
-
getCopyright
public String getCopyright()
Returns the feed copyright.This method is a convenience method, it maps to the Dublin Core module rights.
- Specified by:
getCopyrightin interfaceSyndFeed- Returns:
- the feed copyright, null if none.
-
setCopyright
public void setCopyright(String copyright)
Sets the feed copyright.This method is a convenience method, it maps to the Dublin Core module rights.
- Specified by:
setCopyrightin interfaceSyndFeed- Parameters:
copyright- the feed copyright to set, null if none.
-
getIcon
public SyndImage getIcon()
Returns the feed icon.
-
setIcon
public void setIcon(SyndImage icon)
Sets the feed icon.
-
getImage
public SyndImage getImage()
Returns the feed image.
-
setImage
public void setImage(SyndImage image)
Sets the feed image.
-
getCategories
public List<SyndCategory> getCategories()
Returns the feed categories.This method is a convenience method, it maps to the Dublin Core module subjects.
- Specified by:
getCategoriesin interfaceSyndFeed- Returns:
- a list of SyndCategoryImpl elements with the feed categories, an empty list if none.
-
setCategories
public void setCategories(List<SyndCategory> categories)
Sets the feed categories.This method is a convenience method, it maps to the Dublin Core module subjects.
- Specified by:
setCategoriesin interfaceSyndFeed- Parameters:
categories- the list of SyndCategoryImpl elements with the feed categories to set, an empty list or null if none.
-
getEntries
public List<SyndEntry> getEntries()
Returns the feed entries.- Specified by:
getEntriesin interfaceSyndFeed- Returns:
- a list of SyndEntryImpl elements with the feed entries, an empty list if none.
-
setEntries
public void setEntries(List<SyndEntry> entries)
Sets the feed entries.- Specified by:
setEntriesin interfaceSyndFeed- Parameters:
entries- the list of SyndEntryImpl elements with the feed entries to set, an empty list or null if none.
-
getLanguage
public String getLanguage()
Returns the feed language.This method is a convenience method, it maps to the Dublin Core module language.
- Specified by:
getLanguagein interfaceSyndFeed- Returns:
- the feed language, 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.
- Specified by:
setLanguagein interfaceSyndFeed- Parameters:
language- the feed language to set, null if none.
-
getModules
public List<Module> getModules()
Returns the feed modules.- Specified by:
getModulesin interfaceExtendable- Specified by:
getModulesin interfaceSyndFeed- Returns:
- a list of ModuleImpl elements with the feed modules, an empty list if none.
-
setModules
public void setModules(List<Module> modules)
Sets the feed modules.- Specified by:
setModulesin interfaceExtendable- Specified by:
setModulesin interfaceSyndFeed- Parameters:
modules- the list of ModuleImpl elements with the feed modules to set, an empty list or null if none.
-
getModule
public Module getModule(String uri)
Returns the module identified by a given URI.- Specified by:
getModulein interfaceExtendable- Specified by:
getModulein interfaceSyndFeed- Parameters:
uri- the URI of the ModuleImpl.- Returns:
- The module with the given URI, null if none.
-
getInterface
public Class<SyndFeed> getInterface()
Description copied from interface:CopyFromReturns the interface the copyFrom works on.This is useful when dealing with properties that may have multiple implementations. For example, Module.
- Specified by:
getInterfacein interfaceCopyFrom- Returns:
- the interface the copyFrom works on.
-
copyFrom
public void copyFrom(CopyFrom obj)
Description copied from interface:CopyFromCopies all the properties of the given bean into this one.Any existing properties in this bean are lost.
This method is useful for moving from one implementation of a bean interface to another. For example from the default SyndFeed bean implementation to a Hibernate ready implementation.
-
getAuthors
public List<SyndPerson> getAuthors()
Description copied from interface:SyndFeedReturns the feed authors.For Atom feeds, this returns the authors as a list of SyndPerson objects, for RSS feeds this method is a convenience method, it maps to the Dublin Core module creator.
- Specified by:
getAuthorsin interfaceSyndFeed- Returns:
- the feed authors, null if none.
-
setAuthors
public void setAuthors(List<SyndPerson> authors)
Description copied from interface:SyndFeedSets the feed authors.For Atom feeds, this sets the authors as a list of SyndPerson objects, for RSS feeds this method is a convenience method, it maps to the Dublin Core module creator.
- Specified by:
setAuthorsin interfaceSyndFeed- Parameters:
authors- the feed authors to set, null if none.
-
getAuthor
public String getAuthor()
Returns the feed author.This method is a convenience method, it maps to the Dublin Core module creator.
-
setAuthor
public void setAuthor(String author)
Sets the feed author.This method is a convenience method, it maps to the Dublin Core module creator.
-
getContributors
public List<SyndPerson> getContributors()
Description copied from interface:SyndFeedReturns the feed author.For Atom feeds, this returns the contributors as a list of SyndPerson objects
- Specified by:
getContributorsin interfaceSyndFeed- Returns:
- the feed author, null if none.
-
setContributors
public void setContributors(List<SyndPerson> contributors)
Description copied from interface:SyndFeedSets the feed author.Returns contributors as a list of SyndPerson objects.
- Specified by:
setContributorsin interfaceSyndFeed- Parameters:
contributors- the feed contributors to set, null if none.
-
getForeignMarkup
public List<org.jdom2.Element> getForeignMarkup()
Returns foreign markup found at channel level.- Specified by:
getForeignMarkupin interfaceSyndFeed- Returns:
- Opaque object to discourage use
-
setForeignMarkup
public void setForeignMarkup(List<org.jdom2.Element> foreignMarkup)
Sets foreign markup found at channel level.- Specified by:
setForeignMarkupin interfaceSyndFeed- Parameters:
foreignMarkup- Opaque object to discourage use
-
isPreservingWireFeed
public boolean isPreservingWireFeed()
- Specified by:
isPreservingWireFeedin interfaceSyndFeed- Returns:
- true if this SyndFeed preserves the WireFeed it was created from
-
getDocs
public String getDocs()
Description copied from interface:SyndFeedThis tag should contain a URL that references a description of the channel.
-
setDocs
public void setDocs(String docs)
Description copied from interface:SyndFeedThis tag should contain a URL that references a description of the channel.
-
getGenerator
public String getGenerator()
Description copied from interface:SyndFeedA string indicating the program used to generate the channel.- Specified by:
getGeneratorin interfaceSyndFeed- Returns:
- string indicating the program or
null
-
setGenerator
public void setGenerator(String generator)
Description copied from interface:SyndFeedA string indicating the program used to generate the channel.- Specified by:
setGeneratorin interfaceSyndFeed- Parameters:
generator- indicating the program
-
getManagingEditor
public String getManagingEditor()
Description copied from interface:SyndFeedThe email address of the managing editor of the site, the person to contact for editorial inquiries.- Specified by:
getManagingEditorin interfaceSyndFeed- Returns:
- email address of the managing editor or
null
-
setManagingEditor
public void setManagingEditor(String managingEditor)
Description copied from interface:SyndFeedThe email address of the managing editor of the site, the person to contact for editorial inquiries.- Specified by:
setManagingEditorin interfaceSyndFeed- Parameters:
managingEditor- email address of the managing editor
-
getWebMaster
public String getWebMaster()
Description copied from interface:SyndFeedThe email address of the webmaster for the site, the person to contact if there are technical problems with the channel.- Specified by:
getWebMasterin interfaceSyndFeed- Returns:
- email address of the webmaster or
null
-
setWebMaster
public void setWebMaster(String webMaster)
Description copied from interface:SyndFeedThe email address of the webmaster for the site, the person to contact if there are technical problems with the channel.- Specified by:
setWebMasterin interfaceSyndFeed- Parameters:
webMaster- email address of the webmaster
-
getStyleSheet
public String getStyleSheet()
Description copied from interface:SyndFeedURL of XSL-Stylesheet.- Specified by:
getStyleSheetin interfaceSyndFeed- Returns:
- styleSheet URL or
null
-
setStyleSheet
public void setStyleSheet(String styleSheet)
Description copied from interface:SyndFeedURL of XSL-Stylesheet.- Specified by:
setStyleSheetin interfaceSyndFeed- Parameters:
styleSheet- URL ornull
-
-