org.clapper.curn.parser
Class RSSElement

java.lang.Object
  extended by org.clapper.curn.parser.RSSElement
Direct Known Subclasses:
RSSChannel, RSSItem

public abstract class RSSElement
extends java.lang.Object

Abstract parent class of RSSItem and RSSChannel, containing various shared methods.

Version:
$Revision: 6305 $
See Also:
RSSParser, RSSChannel, RSSItem

Constructor Summary
protected RSSElement()
          Default constructor
 
Method Summary
abstract  void addAuthor(java.lang.String author)
          Add to the element's author list.
abstract  void clearAuthors()
          Clear the authors list.
 java.lang.String getAuthor()
          Get the item's author.
abstract  java.util.Collection<java.lang.String> getAuthors()
          Get the item's author list.
 RSSLink getLink(RSSLink.Type linkType)
          Get the first link with the specified link type.
 RSSLink getLink(java.lang.String mimeType)
          Get the first link with the specified MIME type.
 RSSLink getLink(java.lang.String mimeType, RSSLink.Type... linkTypes)
          Get the link with a specific MIME type and one of a set of link types.
abstract  java.util.Collection<RSSLink> getLinks()
          Get the element's list of published links (its URLs).
 RSSLink getLinkWithFallback(java.lang.String mimeType)
          Get the first link with the specified MIME type.
 RSSLink getURL()
          Get the URL associated with this item.
 void setAuthor(java.lang.String newAuthor)
          Set the item's author.
 void setAuthors(java.util.Collection<java.lang.String> newAuthors)
          Set the item's list of authors to the specified Collection.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RSSElement

protected RSSElement()
Default constructor

Method Detail

getAuthor

public final java.lang.String getAuthor()
Get the item's author. This method simply calls the getAuthors() method and combines the results into a comma-delimited string.

Returns:
the author string, or null if not available
See Also:
setAuthor(java.lang.String), getAuthors()

setAuthor

public final void setAuthor(java.lang.String newAuthor)
Set the item's author. This method clears the existing authors field, then calls addAuthor(java.lang.String). You're better off calling addAuthor(java.lang.String) directly, since some sites support multiple authors for a feed item.

Parameters:
newAuthor - the author, or null if not available
See Also:
setAuthors(java.util.Collection)

setAuthors

public final void setAuthors(java.util.Collection<java.lang.String> newAuthors)
Set the item's list of authors to the specified Collection. This method clears the existing authors field, then calls addAuthor(java.lang.String) for every string in the Collection.

Parameters:
newAuthors - the author, or null if not available
See Also:
addAuthor(java.lang.String), getAuthor(), clearAuthors()

getLink

public final RSSLink getLink(java.lang.String mimeType,
                             RSSLink.Type... linkTypes)
Get the link with a specific MIME type and one of a set of link types.

Parameters:
mimeType - the desired MIME type
linkTypes - one or more link types that are acceptable
Returns:
the link, or null no matches were found

getLink

public final RSSLink getLink(RSSLink.Type linkType)
Get the first link with the specified link type.

Parameters:
linkType - the link type
Returns:
the link, or null if no match was found

getLink

public final RSSLink getLink(java.lang.String mimeType)
Get the first link with the specified MIME type.

Parameters:
mimeType - the MIME type
Returns:
the link, or null if no match was found

getLinkWithFallback

public final RSSLink getLinkWithFallback(java.lang.String mimeType)
Get the first link with the specified MIME type. Fall back to the SELF link if not found. Fall back to the first available link if the SELF link is not found.

Parameters:
mimeType - the MIME type
Returns:
the link, or null if no links are available

getURL

public final RSSLink getURL()
Get the URL associated with this item. This method first attempts to get the SELF link. If that fails, it looks for the first ALTERNATE link.

Returns:
the RSSLink for the URL, or null if it can't be found

getLinks

public abstract java.util.Collection<RSSLink> getLinks()
Get the element's list of published links (its URLs). Each element in the returned Collection is an RSSLink object.

Returns:
the collection of links, or an empty list if there are none. The result will never be null.

getAuthors

public abstract java.util.Collection<java.lang.String> getAuthors()
Get the item's author list.

Returns:
the authors, or null (or an empty Collection) if not available
See Also:
addAuthor(java.lang.String), clearAuthors(), setAuthor(java.lang.String), getAuthor()

addAuthor

public abstract void addAuthor(java.lang.String author)
Add to the element's author list.

Parameters:
author - another author string to add
See Also:
getAuthors(), clearAuthors(), setAuthor(java.lang.String), getAuthor()

clearAuthors

public abstract void clearAuthors()
Clear the authors list.

See Also:
getAuthors(), addAuthor(java.lang.String), setAuthor(java.lang.String), getAuthor()


Copyright © 2004-2006 Brian M. Clapper. All Rights Reserved.