Apache Flink input format for processing Twitter tweet data in JSON format with strongly-typed Tweet objects
—
Twitter user profile information including follower counts, verification status, profile details, and account metadata.
Complete user profile data model representing Twitter user accounts with comprehensive profile information and metrics.
/**
* Twitter user profile information including account details, metrics, and settings.
* Represents the complete user object from Twitter's REST API.
*/
public class Users {
/**
* Default constructor
*/
public Users();
/**
* Resets all fields to default values for object reuse
*/
public void reset();
// Basic user information
/**
* Gets the user's screen name (username without @)
* @return Screen name as string
*/
public String getScreen_name();
/**
* Sets the user's screen name
* @param screen_name - Screen name
*/
public void setScreen_name(String screen_name);
/**
* Gets the user's display name
* @return Display name as string
*/
public String getName();
/**
* Sets the user's display name
* @param name - Display name
*/
public void setName(String name);
/**
* Gets the unique user ID
* @return User ID as long
*/
public long getId();
/**
* Sets the unique user ID
* @param id - User ID
*/
public void setId(long id);
/**
* Gets the user ID as string representation
* @return User ID as string (computed from long ID)
*/
public String getId_str();
/**
* Sets the user ID as string
* @param id_str - User ID string
*/
public void setId_str(String id_str);
/**
* Gets the user's profile description/bio
* @return Description text
*/
public String getDescription();
/**
* Sets the user's profile description/bio
* @param description - Description text
*/
public void setDescription(String description);
/**
* Gets the user's location information
* @return Location string as entered by user
*/
public String getLocation();
/**
* Sets the user's location information
* @param location - Location string
*/
public void setLocation(String location);
/**
* Gets the user's profile URL
* @return URL string
*/
public String getUrl();
/**
* Sets the user's profile URL
* @param url - URL string
*/
public void setUrl(String url);
/**
* Gets the user's account creation timestamp
* @return Creation timestamp in Twitter format
*/
public String getCreated_at();
/**
* Sets the user's account creation timestamp
* @param created_at - Creation timestamp
*/
public void setCreated_at(String created_at);
/**
* Gets the user's language preference
* @return Language code (e.g., "en", "es")
*/
public String getLang();
/**
* Sets the user's language preference
* @param lang - Language code
*/
public void setLang(String lang);
// User metrics
/**
* Gets the number of followers
* @return Follower count as long
*/
public long getFollowers_count();
/**
* Sets the number of followers
* @param followers_count - Follower count
*/
public void setFollowers_count(long followers_count);
/**
* Gets the number of accounts this user follows
* @return Following count as long
*/
public long getFriends_count();
/**
* Sets the number of accounts this user follows
* @param friends_count - Following count
*/
public void setFriends_count(long friends_count);
/**
* Gets the total number of tweets posted by this user
* @return Tweet count as long
*/
public long getStatuses_count();
/**
* Sets the total number of tweets posted by this user
* @param statuses_count - Tweet count
*/
public void setStatuses_count(long statuses_count);
/**
* Gets the number of lists this user is included in
* @return Listed count as long
*/
public long getListed_count();
/**
* Sets the number of lists this user is included in
* @param listed_count - Listed count
*/
public void setListed_count(long listed_count);
/**
* Gets the number of tweets this user has favorited
* @return Favorites count as long
*/
public long getFavourites_count();
/**
* Sets the number of tweets this user has favorited
* @param favourites_count - Favorites count
*/
public void setFavourites_count(long favourites_count);
// Account status and verification
/**
* Checks if the user account is verified
* @return true if verified account
*/
public boolean isVerified();
/**
* Sets the verification status
* @param verified - true if verified account
*/
public void setVerified(boolean verified);
/**
* Checks if the user's tweets are protected (private)
* @return true if tweets are protected
*/
public boolean isProtected_tweet();
/**
* Sets the protected status for user's tweets
* @param protected_tweet - true if tweets are protected
*/
public void setProtected_tweet(boolean protected_tweet);
/**
* Checks if geo-location is enabled for this user
* @return true if geo-location enabled
*/
public boolean isGeo_enabled();
/**
* Sets the geo-location enabled status
* @param geo_enabled - true if geo-location enabled
*/
public void setGeo_enabled(boolean geo_enabled);
/**
* Checks if the user is a translator
* @return true if user is a translator
*/
public boolean isIs_translator();
/**
* Sets the translator status
* @param is_translator - true if user is a translator
*/
public void setIs_translator(boolean is_translator);
/**
* Checks if contributors are enabled for this user
* @return true if contributors enabled
*/
public boolean isContributors_enabled();
/**
* Sets the contributors enabled status
* @param contributors_enabled - true if contributors enabled
*/
public void setContributors_enabled(boolean contributors_enabled);
// Profile appearance
/**
* Gets the profile background color
* @return Background color as hex string
*/
public String getProfile_background_color();
/**
* Sets the profile background color
* @param profile_background_color - Background color hex string
*/
public void setProfile_background_color(String profile_background_color);
/**
* Gets the profile background image URL
* @return Background image URL
*/
public String getProfile_background_image_url();
/**
* Sets the profile background image URL
* @param profile_background_image_url - Background image URL
*/
public void setProfile_background_image_url(String profile_background_image_url);
/**
* Gets the HTTPS profile background image URL
* @return HTTPS background image URL
*/
public String getProfile_background_image_url_https();
/**
* Sets the HTTPS profile background image URL
* @param profile_background_image_url_https - HTTPS background image URL
*/
public void setProfile_background_image_url_https(String profile_background_image_url_https);
/**
* Checks if background image is tiled
* @return true if background image is tiled
*/
public boolean isProfile_background_tile();
/**
* Sets the background image tiling
* @param profile_background_tile - true if background image is tiled
*/
public void setProfile_background_tile(boolean profile_background_tile);
/**
* Gets the profile image URL
* @return Profile image URL
*/
public String getProfile_image_url();
/**
* Sets the profile image URL
* @param profile_image_url - Profile image URL
*/
public void setProfile_image_url(String profile_image_url);
/**
* Gets the HTTPS profile image URL
* @return HTTPS profile image URL
*/
public String getProfile_image_url_https();
/**
* Sets the HTTPS profile image URL
* @param profile_image_url_https - HTTPS profile image URL
*/
public void setProfile_image_url_https(String profile_image_url_https);
/**
* Gets the profile banner URL
* @return Profile banner URL
*/
public String getProfile_banner_url();
/**
* Sets the profile banner URL
* @param profile_banner_url - Profile banner URL
*/
public void setProfile_banner_url(String profile_banner_url);
/**
* Gets the profile link color
* @return Link color as hex string
*/
public String getProfile_link_color();
/**
* Sets the profile link color
* @param profile_link_color - Link color hex string
*/
public void setProfile_link_color(String profile_link_color);
/**
* Gets the profile sidebar border color
* @return Sidebar border color as hex string
*/
public String getProfile_sidebar_border_color();
/**
* Sets the profile sidebar border color
* @param profile_sidebar_border_color - Sidebar border color hex string
*/
public void setProfile_sidebar_border_color(String profile_sidebar_border_color);
/**
* Gets the profile sidebar fill color
* @return Sidebar fill color as hex string
*/
public String getProfile_sidebar_fill_color();
/**
* Sets the profile sidebar fill color
* @param profile_sidebar_fill_color - Sidebar fill color hex string
*/
public void setProfile_sidebar_fill_color(String profile_sidebar_fill_color);
/**
* Gets the profile text color
* @return Text color as hex string
*/
public String getProfile_text_color();
/**
* Sets the profile text color
* @param profile_text_color - Text color hex string
*/
public void setProfile_text_color(String profile_text_color);
/**
* Checks if background image is used in profile
* @return true if background image is used
*/
public boolean isProfile_use_background_image();
/**
* Sets whether to use background image in profile
* @param profile_use_background_image - true to use background image
*/
public void setProfile_use_background_image(boolean profile_use_background_image);
/**
* Checks if using default profile settings
* @return true if using default profile
*/
public boolean isDefault_profile();
/**
* Sets the default profile status
* @param default_profile - true if using default profile
*/
public void setDefault_profile(boolean default_profile);
/**
* Checks if using default profile image
* @return true if using default profile image
*/
public boolean isDefault_profile_image();
/**
* Sets the default profile image status
* @param default_profile_image - true if using default profile image
*/
public void setDefault_profile_image(boolean default_profile_image);
// Relationship status (from current user's perspective)
/**
* Checks if current user is following this user
* @return true if following
*/
public boolean isFollowing();
/**
* Sets the following status
* @param following - true if following
*/
public void setFollowing(boolean following);
/**
* Checks if current user has sent a follow request to this user
* @return true if follow request sent
*/
public boolean isFollow_request_sent();
/**
* Sets the follow request sent status
* @param follow_request_sent - true if follow request sent
*/
public void setFollow_request_sent(boolean follow_request_sent);
/**
* Checks if notifications are enabled for this user
* @return true if notifications enabled
*/
public boolean isNotifications();
/**
* Sets the notifications enabled status
* @param notifications - true if notifications enabled
*/
public void setNotifications(boolean notifications);
// Timezone information
/**
* Gets the user's timezone
* @return Timezone string
*/
public String getTime_zone();
/**
* Sets the user's timezone
* @param time_zone - Timezone string
*/
public void setTime_zone(String time_zone);
/**
* Gets the UTC offset in seconds
* @return UTC offset as long
*/
public long getUtc_offset();
/**
* Sets the UTC offset in seconds
* @param utc_offset - UTC offset
*/
public void setUtc_offset(long utc_offset);
// Additional entities
/**
* Gets the entities extracted from user profile fields
* @return Entities object containing URLs, mentions from profile
*/
public Entities getEntities();
/**
* Sets the entities extracted from user profile fields
* @param entities - Entities object
*/
public void setEntities(Entities entities);
}Usage Examples:
import org.apache.flink.contrib.tweetinputformat.model.User.Users;
import org.apache.flink.contrib.tweetinputformat.model.tweet.Tweet;
// Access user information from tweets
DataSet<Tweet> tweets = env.readFile(new SimpleTweetInputFormat(), "tweets.json");
// Extract verified users
DataSet<Users> verifiedUsers = tweets
.filter(tweet -> tweet.getUser().isVerified())
.map(tweet -> tweet.getUser())
.distinct(user -> user.getId());
// Analyze user engagement
DataSet<Tuple3<String, Long, Long>> userMetrics = tweets
.map(tweet -> {
Users user = tweet.getUser();
return new Tuple3<>(
user.getScreen_name(),
user.getFollowers_count(),
user.getStatuses_count()
);
});
// Find influential users (high follower-to-following ratio)
DataSet<String> influentialUsers = tweets
.map(tweet -> tweet.getUser())
.filter(user -> user.getFollowers_count() > user.getFriends_count() * 10)
.map(user -> user.getScreen_name());// User profile analysis
Tweet tweet = new Tweet();
// Tweet populated by input format...
Users user = tweet.getUser();
// Basic user info
System.out.println("User: @" + user.getScreen_name());
System.out.println("Name: " + user.getName());
System.out.println("Bio: " + user.getDescription());
System.out.println("Location: " + user.getLocation());
// User metrics
System.out.println("Followers: " + user.getFollowers_count());
System.out.println("Following: " + user.getFriends_count());
System.out.println("Tweets: " + user.getStatuses_count());
System.out.println("Listed: " + user.getListed_count());
// Account status
if (user.isVerified()) {
System.out.println("✓ Verified account");
}
if (user.isProtected_tweet()) {
System.out.println("🔒 Protected tweets");
}
// Profile customization
if (!user.isDefault_profile()) {
System.out.println("Profile colors: bg=" + user.getProfile_background_color() +
", link=" + user.getProfile_link_color());
}Key Features:
Install with Tessl CLI
npx tessl i tessl/maven-org-apache-flink--flink-tweet-inputformat-2-10