winterwell.jtwitter
Class User

java.lang.Object
  extended by winterwell.jtwitter.User
All Implemented Interfaces:
java.io.Serializable

public final class User
extends java.lang.Object
implements java.io.Serializable

A Twitter user. Fields are null if unset.

See Also:
Serialized Form

Field Summary
 java.util.Date createdAt
           
 java.lang.String description
           
 int favoritesCount
           
 int followersCount
           
 boolean followRequestSent
          True if the authenticated user has requested to follow this user.
 int friendsCount
          The number of people this user is following.
 java.lang.Long id
           
 int listedCount
          The number of public lists a user is listed in.
 java.lang.String location
          The location, as reported by the user.
 java.lang.String name
          The display name, e.g.
 boolean notifications
           
 java.lang.String profileBackgroundColor
           
 java.net.URI profileBackgroundImageUrl
           
 boolean profileBackgroundTile
           
 java.net.URI profileImageUrl
          The url for the user's Twitter profile picture.
 java.lang.String profileLinkColor
           
 java.lang.String profileSidebarBorderColor
           
 java.lang.String profileSidebarFillColor
           
 java.lang.String profileTextColor
           
 boolean protectedUser
          true if this user keeps their updates private
 java.lang.String screenName
          The login name, e.g.
 Status status
          The user's current status - *if* returned by Twitter.
 int statusesCount
           
 java.lang.String timezone
           
 double timezoneOffSet
          Number of seconds between a user's registered time zone and Greenwich Mean Time (GMT) - aka Coordinated Universal Time or UTC.
 boolean verified
           
 java.net.URI website
           
 
Constructor Summary
User(java.lang.String screenName)
          Create a dummy User object.
 
Method Summary
 boolean equals(java.lang.Object other)
           
 java.util.Date getCreatedAt()
           
 java.lang.String getDescription()
           
 int getFavoritesCount()
          Number of statuses a user has marked as favorite.
Warning: can be zero if Twitter did not supply the info (e.g.
 int getFollowersCount()
           
 int getFriendsCount()
           
 java.lang.Long getId()
           
 java.lang.String getLang()
          User's language (2 letter code)
 java.lang.String getLocation()
           
 java.lang.String getName()
          The display name, e.g.
 Place getPlace()
           
 java.lang.String getProfileBackgroundColor()
           
 java.net.URI getProfileBackgroundImageUrl()
           
 java.net.URI getProfileImageUrl()
           
 java.lang.String getProfileLinkColor()
           
 java.lang.String getProfileSidebarBorderColor()
           
 java.lang.String getProfileSidebarFillColor()
           
 java.lang.String getProfileTextColor()
           
 boolean getProtectedUser()
           
 java.lang.String getScreenName()
          The login name, e.g.
 Status getStatus()
          The user's current status - *if* returned by Twitter.
 int getStatusesCount()
           
 java.lang.String getTimezone()
          String version of the timezone
 double getTimezoneOffSet()
          Number of seconds between a user's registered time zone and Greenwich Mean Time (GMT) - aka Coordinated Universal Time or UTC.
 java.net.URI getWebsite()
           
 int hashCode()
           
 boolean isDummyObject()
           
 java.lang.Boolean isFollowedByYou()
          Are you following this person?
 java.lang.Boolean isFollowingYou()
          Is this person following you?
 boolean isNotifications()
           
 boolean isProfileBackgroundTile()
           
 boolean isProtectedUser()
          true if this user keeps their updates private
 boolean isVerified()
           
 java.lang.String toString()
          Returns the User's screenName (i.e.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

createdAt

public final java.util.Date createdAt

description

public final java.lang.String description

favoritesCount

public final int favoritesCount

followersCount

public int followersCount

followRequestSent

public final boolean followRequestSent
True if the authenticated user has requested to follow this user. This will be false unless the friendship request is pending. False if Twitter does not say otherwise.


friendsCount

public final int friendsCount
The number of people this user is following.

"following count" would be a better name, but historically Twitter calls this "friends count".


id

public final java.lang.Long id

listedCount

public final int listedCount
The number of public lists a user is listed in. -1 if unknown.


location

public final java.lang.String location
The location, as reported by the user. Can be metaphorical, e.g. "close to your heart"), or null; never blank. UberTwitter & similar lat/long references will be normalised using InternalUtils.latLongLocn.


name

public final java.lang.String name
The display name, e.g. "Daniel Winterstein"


notifications

public final boolean notifications

profileBackgroundColor

public final java.lang.String profileBackgroundColor

profileBackgroundImageUrl

public final java.net.URI profileBackgroundImageUrl

profileBackgroundTile

public final boolean profileBackgroundTile

profileImageUrl

public java.net.URI profileImageUrl
The url for the user's Twitter profile picture.

Note: we allow this to be edited as a convenience for the User objects generated by search


profileLinkColor

public final java.lang.String profileLinkColor

profileSidebarBorderColor

public final java.lang.String profileSidebarBorderColor

profileSidebarFillColor

public final java.lang.String profileSidebarFillColor

profileTextColor

public final java.lang.String profileTextColor

protectedUser

public final boolean protectedUser
true if this user keeps their updates private


screenName

public final java.lang.String screenName
The login name, e.g. "winterstein" This is the only thing used by equals() and hashcode(). This is always lower-case, as Twitter screen-names are case insensitive, *unless* you set Twitter.CASE_SENSITIVE_SCREENNAMES


status

public final Status status
The user's current status - *if* returned by Twitter. Not all calls return this, so can be null.


statusesCount

public final int statusesCount

timezone

public final java.lang.String timezone

timezoneOffSet

public final double timezoneOffSet
Number of seconds between a user's registered time zone and Greenwich Mean Time (GMT) - aka Coordinated Universal Time or UTC. Can be positive or negative.


verified

public final boolean verified

website

public final java.net.URI website
Constructor Detail

User

public User(java.lang.String screenName)
Create a dummy User object. All fields are set to null. This will be equals() to an actual User object, so it can be used to query collections. E.g.
 // Test whether jtwit is a friend
 twitter.getFriends().contains(new User("jtwit"));
 

Parameters:
screenName - This will be converted to lower-case as Twitter screen-names are case insensitive (unless Twitter.CASE_SENSITIVE_SCREENNAMES is set)
Method Detail

getLang

public java.lang.String getLang()
User's language (2 letter code)

Returns:
e.g. "en"

equals

public boolean equals(java.lang.Object other)
Overrides:
equals in class java.lang.Object

getCreatedAt

public java.util.Date getCreatedAt()

getDescription

public java.lang.String getDescription()

getFavoritesCount

public int getFavoritesCount()
Number of statuses a user has marked as favorite.
Warning: can be zero if Twitter did not supply the info (e.g. User objects from searches or RSS feeds)


getFollowersCount

public int getFollowersCount()
Returns:
Number of followers.
Warning: can be zero if Twitter did not supply the info (e.g. User objects from searches or RSS feeds)

getFriendsCount

public int getFriendsCount()
Returns:
number of people this user is following.
Warning: can be zero if Twitter did not supply the info (e.g. User objects from searches or RSS feeds)

getId

public java.lang.Long getId()
Returns:
The Twitter id for this post. This is used by some API methods.

Note: this may switch to BigInteger in the future, if Twitter change their id numbering scheme. Use Number (which is a super-class for both Long and BigInteger) if you wish to future-proof your code.


getLocation

public java.lang.String getLocation()
See Also:
location

getName

public java.lang.String getName()
The display name, e.g. "Daniel Winterstein"

See Also:
getScreenName()

getPlace

public Place getPlace()

getProfileBackgroundColor

public java.lang.String getProfileBackgroundColor()

getProfileBackgroundImageUrl

public java.net.URI getProfileBackgroundImageUrl()

getProfileImageUrl

public java.net.URI getProfileImageUrl()

getProfileLinkColor

public java.lang.String getProfileLinkColor()

getProfileSidebarBorderColor

public java.lang.String getProfileSidebarBorderColor()

getProfileSidebarFillColor

public java.lang.String getProfileSidebarFillColor()

getProfileTextColor

public java.lang.String getProfileTextColor()

getProtectedUser

public boolean getProtectedUser()

getScreenName

public java.lang.String getScreenName()
The login name, e.g. "winterstein". Never null


getStatus

public Status getStatus()
The user's current status - *if* returned by Twitter. Not all calls return this, so can be null.


getStatusesCount

public int getStatusesCount()
Returns:
number of status updates posted by this User.
Warning: can be zero if Twitter did not supply the info (e.g. User objects from searches or RSS feeds)

getTimezone

public java.lang.String getTimezone()
String version of the timezone


getTimezoneOffSet

public double getTimezoneOffSet()
Number of seconds between a user's registered time zone and Greenwich Mean Time (GMT) - aka Coordinated Universal Time or UTC. Can be positive or negative.


getWebsite

public java.net.URI getWebsite()

hashCode

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

isDummyObject

public boolean isDummyObject()
Returns:
true if this is a dummy User object, in which case almost all of it's fields will be null - with the exception of screenName and possibly profileImageUrl. Dummy User objects are equals() to full User objects.

isFollowedByYou

public java.lang.Boolean isFollowedByYou()
Are you following this person?

Returns:
true if you are following this user. null if unset -- though this is quite rare.

isFollowingYou

public java.lang.Boolean isFollowingYou()
Is this person following you?

Returns:
true if this user is following you. null if unset -- which is common!

isNotifications

public boolean isNotifications()

isProfileBackgroundTile

public boolean isProfileBackgroundTile()

isProtectedUser

public boolean isProtectedUser()
true if this user keeps their updates private


isVerified

public boolean isVerified()
Returns:
true if the account has been verified by Twitter to really be who it claims to be.

toString

public java.lang.String toString()
Returns the User's screenName (i.e. their Twitter login)

Overrides:
toString in class java.lang.Object