Jitsi: the OpenSource Java VoIP and Instant Messaging client.

net.java.sip.communicator.impl.protocol.rss
Class RssItemKey

java.lang.Object
  extended by net.java.sip.communicator.impl.protocol.rss.RssItemKey

public class RssItemKey
extends Object

The RssItemKey is used to encapsulate information pertaining to the last item retrieved from a RSS feed. It can be used with both feeds that provide and that don't provide a date for their contents.

Author:
Mihai Balan, Vincent Lucas

Constructor Summary
RssItemKey(com.sun.syndication.feed.synd.SyndEntry entry)
          Creates a RssContactSettings object that uses date if possible or at least URI to identify feed items.
 
Method Summary
 int compareTo(RssItemKey obj)
          Compare 2 RssItemKey.
static RssItemKey deserialize(String settings)
          Used for restoring the key information from a textual representation.
 Date getItemDate()
          Returns the date that is used as a key.
 String getItemUri()
          Returns the URI that is used as a key.
 String serialize()
          Serializes current key to a textual representation.
 String toString()
          Returns the textual representation of the settings object.
 boolean usesDate()
          Determines if the current key uses Date as a means of identification or not.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RssItemKey

public RssItemKey(com.sun.syndication.feed.synd.SyndEntry entry)
Creates a RssContactSettings object that uses date if possible or at least URI to identify feed items.

Parameters:
entry - The last Syndentry of the RSS feed.
Method Detail

usesDate

public boolean usesDate()
Determines if the current key uses Date as a means of identification or not. Usually if true is returned this also implies that getItemUri() == null so this should be used with care. Similarly, if false is returned, one should assume that getItemDate() == null.

Returns:
true if date is used for identification, false otherwise.
See Also:
getItemDate(), getItemUri()

getItemDate

public Date getItemDate()
Returns the date that is used as a key. Note that null can also be returned in case usesDate() == false.

Returns:
date field of the key.
See Also:
usesDate()

getItemUri

public String getItemUri()
Returns the URI that is used as a key. Note that null can also be returned in case usesDate() == true.

Returns:
URI field of the key.
See Also:
usesDate()

deserialize

public static RssItemKey deserialize(String settings)
Used for restoring the key information from a textual representation.

Parameters:
settings - textual representation of the stored data
Returns:
the result rss item

serialize

public String serialize()
Serializes current key to a textual representation.

Returns:
String containing the textual representation of the current key.

toString

public String toString()
Returns the textual representation of the settings object. This can be easily de-serialized with a call to deserialize().

Overrides:
toString in class Object
See Also:
deserialize(String)

compareTo

public int compareTo(RssItemKey obj)
Compare 2 RssItemKey. Compare items with date or with uri, but return always 1 when we can't say anything about order (one is date, the other is uri or the obj is null).


Jitsi: the OpenSource Java VoIP and Instant Messaging client.

Jitsi, the OpenSource Java VoIP and Instant Messaging client.
Distributable under LGPL license.