winterwell.jtwitter
Class Twitter.Status

java.lang.Object
  extended by winterwell.jtwitter.Twitter.Status
All Implemented Interfaces:
java.io.Serializable, Twitter.ITweet
Enclosing class:
Twitter

public static final class Twitter.Status
extends java.lang.Object
implements Twitter.ITweet

A Twitter status post. .toString() returns the status text.

Notes: This is a finalised data object. It exposes its fields for convenient access. If you want to change your status, use Twitter.setStatus(String) and Twitter.destroyStatus(Status).

See Also:
Serialized Form

Field Summary
 java.util.Date createdAt
           
 java.math.BigInteger id
          Warning: use equals() not == to compare these!
 java.math.BigInteger inReplyToStatusId
          Often null (even when this Status is a reply).
 int retweetCount
          Represents the number of times a status has been retweeted using _new-style_ retweets.
 java.lang.String source
          E.g.
 java.lang.String text
          The actual status text.
 Twitter.User user
          Rarely null.
 
Constructor Summary
Twitter.Status(Twitter.User user, java.lang.String text, java.lang.Number id, java.util.Date createdAt)
          Deprecated. 
 
Method Summary
 boolean equals(java.lang.Object obj)
          Tests by class=Status and tweet id number
 java.util.Date getCreatedAt()
           
 java.math.BigInteger getId()
          Twitter IDs are numbers - but they can exceed the range of Java's signed long.
 java.lang.String getLocation()
           
 java.util.List<java.lang.String> getMentions()
           
 Twitter.Status getOriginal()
          Only set for official new-style retweets.
 java.lang.String getText()
          The actual status text.
 java.util.List<Twitter.TweetEntity> getTweetEntities(Twitter.KEntityType type)
          Twitter are wrapping some urls with their own url-shortener (as a defence against malicious tweets).
 Twitter.User getUser()
          The User who made the tweet
 int hashCode()
           
 boolean isFavorite()
          true if this has been marked as a favourite by the authenticating user
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

createdAt

public final java.util.Date createdAt

id

public final java.math.BigInteger id
Warning: use equals() not == to compare these!


text

public final java.lang.String text
The actual status text.


user

public final Twitter.User user
Rarely null.

When can this be null?
- If creating a "fake" tweet via Status#Status(User, String, long, Date) and supplying a null User!


source

public final java.lang.String source
E.g. "web" vs. "im"

"fake" if this Status was made locally or from an RSS feed rather than retrieved from Twitter json (as normal).


inReplyToStatusId

public final java.math.BigInteger inReplyToStatusId
Often null (even when this Status is a reply). This is the in-reply-to status id as reported by Twitter.


retweetCount

public final int retweetCount
Represents the number of times a status has been retweeted using _new-style_ retweets. -1 if unknown.

Constructor Detail

Twitter.Status

@Deprecated
public Twitter.Status(Twitter.User user,
                                 java.lang.String text,
                                 java.lang.Number id,
                                 java.util.Date createdAt)
Deprecated. 

Create a *fake* Status object. This does not represent a real tweet! Uses: few and far between. There is no real contract as to how objects made in this way will behave.

If you want to post a tweet (and hence get a real Status object), use Twitter.setStatus(String).

Parameters:
user - Can be null or bogus -- provided that's OK with your code.
text - Can be null or bogus -- provided that's OK with your code.
id - Can be null or bogus -- provided that's OK with your code.
createdAt - Can be null -- provided that's OK with your code.
Method Detail

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Tests by class=Status and tweet id number

Overrides:
equals in class java.lang.Object

getLocation

public java.lang.String getLocation()
Returns:
the location of this tweet. Can be null. This can come from geo-tagging or the user's location. This may be a place name, or in the form "latitude,longitude" if it came from a geo-tagged source.

getOriginal

public Twitter.Status getOriginal()
Only set for official new-style retweets. This is the original retweeted Status. null otherwise.


isFavorite

public boolean isFavorite()
true if this has been marked as a favourite by the authenticating user


getCreatedAt

public java.util.Date getCreatedAt()
Specified by:
getCreatedAt in interface Twitter.ITweet

getId

public java.math.BigInteger getId()
Description copied from interface: Twitter.ITweet
Twitter IDs are numbers - but they can exceed the range of Java's signed long.

Specified by:
getId in interface Twitter.ITweet
Returns:
The Twitter id for this post. This is used by some API methods.

getMentions

public java.util.List<java.lang.String> getMentions()
Returns:
list of \@mentioned people (there is no guarantee that these mentions are for correct Twitter screen-names). May be empty, never null. Screen-names are always lowercased.

getTweetEntities

public java.util.List<Twitter.TweetEntity> getTweetEntities(Twitter.KEntityType type)
Twitter are wrapping some urls with their own url-shortener (as a defence against malicious tweets). You are recommended to direct people to the Twitter-url, but use the original url for display.

Entity support is off by default. Request entity support by setting Twitter.setIncludeTweetEntities(boolean). Twitter do NOT support entities for search :(

Parameters:
type - urls, user_mentions, or hashtags
Returns:
the text entities in this tweet

getText

public java.lang.String getText()
The actual status text. This is also returned by toString()

Specified by:
getText in interface Twitter.ITweet

getUser

public Twitter.User getUser()
Description copied from interface: Twitter.ITweet
The User who made the tweet

Specified by:
getUser in interface Twitter.ITweet

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
Returns:
The text of this status. E.g. "Kicking fommil's arse at Civilisation."