com.johnmunsch.rss
Class Item

java.lang.Object
  |
  +--com.johnmunsch.rss.Item
All Implemented Interfaces:
java.io.Serializable

public class Item
extends java.lang.Object
implements java.io.Serializable

Represents a single item from an RSS channel. Normally items consist of a pair or triplet of a title for the item, the link to that item, and optionally a description of the item.

Author:
John Munsch
See Also:
Serialized Form

Constructor Summary
Item(Channel _origin, java.lang.String _title, java.lang.String _link)
          Creates a new Item with the minimal expected data.
Item(Channel _origin, java.lang.String _title, java.lang.String _link, java.lang.String _description)
          Creates new Item with a description.
Item(Channel _origin, java.lang.String _title, java.lang.String _link, java.lang.String _description, java.util.Date _retrieved)
          Creates a new Item with a description and a retrieval date.
 
Method Summary
 boolean equals(java.lang.Object obj)
          Indicates whether some other object is "equal to" this one.
 Channel getChannel()
          Returns the channel from which this object was generated.
 java.lang.String getDescription()
          The description (if any) for this item.
 java.net.URL getLink()
          Get a link to the item.
 java.util.Properties getProperties()
          Returns the properties set for this object or null if no properties have been set.
 java.lang.String getProperty(java.lang.String key)
          Provides direct access to a getProperty function on the Properties object.
 java.lang.String getProperty(java.lang.String key, java.lang.String defaultValue)
          Provides direct access to a getProperty function on the Properties object.
 java.util.Date getRetrieved()
          Returns the date and time this item was retrieved.
 java.lang.String getTitle()
          Get the title of this item.
 int hashCode()
          Generates a reasonably unique hash code for this item.
 java.lang.Object setProperty(java.lang.String key, java.lang.String value)
          Provides direct access to the setProperty function on the Properties object.
 java.lang.String toString()
          Generates a nicely formatted string representation of this item.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Item

public Item(Channel _origin,
            java.lang.String _title,
            java.lang.String _link)
Creates a new Item with the minimal expected data.


Item

public Item(Channel _origin,
            java.lang.String _title,
            java.lang.String _link,
            java.lang.String _description)
Creates new Item with a description.


Item

public Item(Channel _origin,
            java.lang.String _title,
            java.lang.String _link,
            java.lang.String _description,
            java.util.Date _retrieved)
Creates a new Item with a description and a retrieval date.

Method Detail

equals

public boolean equals(java.lang.Object obj)
Indicates whether some other object is "equal to" this one. This should have all the "Object" class meanings for this function.

Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Generates a reasonably unique hash code for this item. Currently it uses the hash codes for the title and the link added together.

Overrides:
hashCode in class java.lang.Object

toString

public java.lang.String toString()
Generates a nicely formatted string representation of this item.

Overrides:
toString in class java.lang.Object

getChannel

public Channel getChannel()
Returns the channel from which this object was generated.


getRetrieved

public java.util.Date getRetrieved()
Returns the date and time this item was retrieved.


getProperties

public java.util.Properties getProperties()
Returns the properties set for this object or null if no properties have been set. Most of the functionality for dealing with the properties on an item have to be accessed through this object. Only the most basic gets and sets have been provided directly on the item's interface.


getProperty

public java.lang.String getProperty(java.lang.String key)
Provides direct access to a getProperty function on the Properties object.


getProperty

public java.lang.String getProperty(java.lang.String key,
                                    java.lang.String defaultValue)
Provides direct access to a getProperty function on the Properties object.


setProperty

public java.lang.Object setProperty(java.lang.String key,
                                    java.lang.String value)
Provides direct access to the setProperty function on the Properties object.


getTitle

public java.lang.String getTitle()
Get the title of this item.


getLink

public java.net.URL getLink()
Get a link to the item. There is a small chance this could be null if the URL string for this item was malformed and could not be turned into a URL object.


getDescription

public java.lang.String getDescription()
The description (if any) for this item. This is frequently an empty string.