winterwell.jtwitter
Class Twitter.User

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

public static final class Twitter.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 user you are authenticating as 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.
 Twitter.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
Twitter.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 getLocation()
           
 java.lang.String getName()
          The display name, e.g.
 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.
 Twitter.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()
           
 boolean isFollowedByYou()
          Are you following this person?
 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

description

public final java.lang.String description

id

public final java.lang.Long id

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. UberTwitter & similar lat/long references will be normalised using Twitter.latLongLocn.


name

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


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


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 Twitter.Status status
The user's current status - *if* returned by Twitter. Not all calls return this, so can be null.


website

public final java.net.URI website

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.


timezone

public final java.lang.String timezone

followersCount

public int followersCount

profileBackgroundColor

public final java.lang.String profileBackgroundColor

profileLinkColor

public final java.lang.String profileLinkColor

profileTextColor

public final java.lang.String profileTextColor

profileSidebarFillColor

public final java.lang.String profileSidebarFillColor

profileSidebarBorderColor

public final java.lang.String profileSidebarBorderColor

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


createdAt

public final java.util.Date createdAt

favoritesCount

public final int favoritesCount

profileBackgroundImageUrl

public final java.net.URI profileBackgroundImageUrl

profileBackgroundTile

public final boolean profileBackgroundTile

statusesCount

public final int statusesCount

notifications

public final boolean notifications

verified

public final boolean verified

followRequestSent

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


listedCount

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

Constructor Detail

Twitter.User

public Twitter.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

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

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

isFollowingYou

public boolean isFollowingYou()
Is this person following you?


isFollowedByYou

public boolean isFollowedByYou()
Are you following this person?


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