public final class Status extends java.lang.Object implements Twitter.ITweet
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)
.
This class reuses part of Twitter's twitter-text project. Taken from Extractor.java
(https://github.com/twitter/twitter-text/blob/master/java/src/com/twitter/Extractor.java)
on 2016-07-14. Reproduced under the Apache license.
Modifier and Type | Field and Description |
---|---|
java.util.Date |
createdAt |
int |
favoriteCount
Number of likes for this tweet.
|
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 and Description |
---|
Status(com.winterwell.json.JSONObject object,
User user) |
Status(User user,
java.lang.String text,
java.lang.Number id,
java.util.Date createdAt)
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
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 |
getLang()
BCP 47 language identifiers.
|
java.lang.String |
getLocation() |
java.util.List<java.lang.String> |
getMentions() |
Status |
getOriginal()
Only set for official new-style retweets and quoted tweets.
|
Place |
getPlace() |
java.lang.String |
getSource()
E.g.
|
static java.util.List<Status> |
getStatuses(com.winterwell.json.JSONArray array) |
static java.util.List<Status> |
getStatuses(java.lang.String json)
Convert from a json array of objects into a list of tweets.
|
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).
|
java.lang.String |
getUrl() |
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 |
isQuotedStatus() |
boolean |
isRetweet() |
boolean |
isSensitive()
A self-applied label for sensitive content (eg.
|
java.lang.String |
toString() |
public final java.util.Date createdAt
public final java.math.BigInteger id
public final java.math.BigInteger inReplyToStatusId
public final int retweetCount
public final int favoriteCount
public final java.lang.String source
getSource()
instead.
"fake" if this Status was made locally or from an RSS feed rather than retrieved from Twitter json (as normal).
public final java.lang.String text
public final User user
When can this be null?
- If creating a "fake" tweet via
Status#Status(User, String, long, Date)
and supplying a null User!
- For the original of a retweet -- Twitter needn't tell us the details :(
public Status(com.winterwell.json.JSONObject object, User user) throws TwitterException
object
- user
- Set when parsing the json returned for a User. null when
parsing the json returned for a Status.TwitterException
@Deprecated public Status(User user, java.lang.String text, java.lang.Number id, java.util.Date createdAt)
If you want to post a tweet (and hence get a real Status object), use
Twitter.setStatus(String)
.
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.public static java.util.List<Status> getStatuses(java.lang.String json) throws TwitterException
json
- can be empty, must not be nullTwitterException
public static java.util.List<Status> getStatuses(com.winterwell.json.JSONArray array) throws TwitterException
TwitterException
public boolean isRetweet()
public boolean isQuotedStatus()
public java.lang.String getLang()
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public java.util.Date getCreatedAt()
getCreatedAt
in interface Twitter.ITweet
public java.math.BigInteger getId()
Twitter.ITweet
getId
in interface Twitter.ITweet
public java.lang.String getLocation()
getLocation
in interface Twitter.ITweet
Note: This will be set if Twitter supply any geo-information. We extract a location from geo and place objects.
public java.util.List<java.lang.String> getMentions()
getMentions
in interface Twitter.ITweet
Twitter.CASE_SENSITIVE_SCREENNAMES
is switched on.public Status getOriginal()
public Place getPlace()
getPlace
in interface Twitter.ITweet
public java.lang.String getSource()
source
. This method will remove the wrapping a-tag.
"fake" if this Status was made locally or from an RSS feed rather than retrieved from Twitter json (as normal).
public java.lang.String getText()
toString()
.
NB: This can be longer than 140 chars for a retweet.getText
in interface Twitter.ITweet
public java.util.List<Twitter.TweetEntity> getTweetEntities(Twitter.KEntityType type)
Twitter.ITweet
Entity support is off by default. Request entity support by setting
Twitter.setIncludeTweetEntities(boolean)
. Twitter do NOT
support entities for search :(
getTweetEntities
in interface Twitter.ITweet
type
- urls, user_mentions, or hashtagspublic User getUser()
Twitter.ITweet
getUser
in interface Twitter.ITweet
public int hashCode()
hashCode
in class java.lang.Object
public boolean isFavorite()
public boolean isSensitive()
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String getDisplayText()
getDisplayText
in interface Twitter.ITweet
public java.lang.String getUrl()