winterwell.jtwitter
Class Status

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

public final class 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.
 User user
          Rarely null.
 
Constructor Summary
Status(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.lang.String getDisplayText()
           
 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()
           
 Status getOriginal()
          Only set for official new-style retweets.
 Place getPlace()
           
 java.lang.String getText()
          The actual status text.
 java.util.List<Twitter.TweetEntity> getTweetEntities(Twitter.KEntityType type)
          Twitter wrap urls with their own url-shortener (as a defence against malicious tweets).
 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
 boolean isSensitive()
          A self-applied label for sensitive content (eg.
 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!


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.


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).


text

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


user

public final 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!

Constructor Detail

Status

@Deprecated
public Status(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

equals

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

Overrides:
equals in class java.lang.Object

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.

getLocation

public java.lang.String getLocation()
Specified by:
getLocation in interface Twitter.ITweet
Returns:
the location of this tweet. Can be null, never blank. 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.

Note: This will be set if Twitter supply any geo-information. We extract a location from geo and place objects.


getMentions

public java.util.List<java.lang.String> getMentions()
Specified by:
getMentions in interface Twitter.ITweet
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 -- unless Twitter.CASE_SENSITIVE_SCREENNAMES is switched on.

getOriginal

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


getPlace

public Place getPlace()
Specified by:
getPlace in interface Twitter.ITweet
Returns:
more information on the location of this tweet. This is usually null!

getText

public java.lang.String getText()
The actual status text. This is also returned by toString(). NB: This can be longer than 140 chars for a retweet.

Specified by:
getText in interface Twitter.ITweet

getTweetEntities

public java.util.List<Twitter.TweetEntity> getTweetEntities(Twitter.KEntityType type)
Description copied from interface: Twitter.ITweet
Twitter wrap 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 :(

Specified by:
getTweetEntities in interface Twitter.ITweet
Parameters:
type - urls, user_mentions, or hashtags
Returns:
the text entities in this tweet, or null if the info was not supplied.

getUser

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

Specified by:
getUser in interface Twitter.ITweet

hashCode

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

isFavorite

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


isSensitive

public boolean isSensitive()
A self-applied label for sensitive content (eg. X-rated images). Obviously, you can only rely on this label if the tweeter is reliably setting it.

Returns:
true=kinky, false=family-friendly

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."

getDisplayText

public java.lang.String getDisplayText()
Specified by:
getDisplayText in interface Twitter.ITweet
Returns:
text, with the t.co urls replaced. Use-case: for filtering based on text contents, when we want to match against the full url. Note: this does NOT resolve short urls from bit.ly etc.