public class DirectMessage {
    private final long id;

    private final String text;

    private final TwitterProfile sender;

    private final TwitterProfile recipient;

    private final Date createdAt;

    public DirectMessage(long id, String text, TwitterProfile sender, TwitterProfile recipient, Date createdAt) {
        this.id = id;
        this.text = text;
        this.sender = sender;
        this.recipient = recipient;
        this.createdAt = createdAt;
    }

    public long getId() {
        return id;
    }

    public String getText() {
        return text;
    }

    public TwitterProfile getSender() {
        return sender;
    }

    public TwitterProfile getRecipient() {
        return recipient;
    }

    public Date getCreatedAt() {
        return createdAt;
    }

} public class Place {

    private final String id;

    private final String name;

    private final String fullName;

    private final String streetAddress;

    private final String country;

    private final String countryCode;

    private final PlaceType placeType;

    public Place(String id, String name, String fullName, String streetAddress, String country, String countryCode,
                 PlaceType placeType) {
        this.id = id;
        this.name = name;
        this.fullName = fullName;
        this.country = country;
        this.streetAddress = streetAddress;
        this.countryCode = countryCode;
        this.placeType = placeType;
    }

    public String getId() {
        return id;
    }

    public String getName() {
        return name;
    }

    public String getFullName() {
        return fullName;
    }

    public String getStreetAddress() {
        return streetAddress;
    }

    public String getCountry() {
        return country;
    }

    public String getCountryCode() {
        return countryCode;
    }

    public PlaceType getPlaceType() {
        return placeType;
    }

} public class RateLimitStatus {

    private final int hourlyLimit;

    private final int remainingHits;

    private final long resetTimeInSeconds;

    private final Date resetTime;

    public RateLimitStatus(int hourlyLimit, int remainingHits, long resetTimeInSeconds) {
        this.hourlyLimit = hourlyLimit;
        this.remainingHits = remainingHits;
        this.resetTimeInSeconds = resetTimeInSeconds;
        this.resetTime = new Date(resetTimeInSeconds * 1000);
    }

    public int getHourlyLimit() {
        return hourlyLimit;
    }

    public int getRemainingHits() {
        return remainingHits;
    }

    public long getResetTimeInSeconds() {
        return resetTimeInSeconds;
    }

    public Date getResetTime() {
        return resetTime;
    }

    /**
     * The approximate number of seconds until the rate limits are reset. Note that this method recalculates the seconds until
     * reset on each call.
     */
    public int getSecondsUntilReset() {
        return (int) (resetTimeInSeconds - System.currentTimeMillis() / 1000);
    }
} public class SavedSearch {
    private final long id;

    private final String name;

    private final String query;

    private final Date createdAt;

    private final int position;

    public SavedSearch(long id, String name, String query, int position, Date createdAt) {
        this.id = id;
        this.name = name;
        this.query = query;
        this.position = position;
        this.createdAt = createdAt;
    }

    public long getId() {
        return id;
    }

    public String getName() {
        return name;
    }

    public String getQuery() {
        return query;
    }

    public Date getCreatedAt() {
        return createdAt;
    }

    public int getPosition() {
        return position;
    }

} public class SearchResults {
    private List<Tweet> tweets;

    private long maxId;

    private long sinceId;

    private boolean lastPage;

    public SearchResults(List<Tweet> tweets, long maxId, long sinceId) {
        this(tweets, maxId, sinceId, false);
    }

    public SearchResults(List<Tweet> tweets, long maxId, long sinceId, boolean lastPage) {
        this.tweets = tweets;
        this.maxId = maxId;
        this.sinceId = sinceId;
        this.lastPage = lastPage;
    }

    /**
     * Returns the list of matching {@link Tweet}s
     */
    public List<Tweet> getTweets() {
        return tweets;
    }

    /**
     * Returns the maximum {@link Tweet} ID in the search results
     */
    public long getMaxId() {
        return maxId;
    }

    /**
     * Returns the {@link Tweet} ID after which all of the matching {@link Tweet}s were created
     */
    public long getSinceId() {
        return sinceId;
    }

    /**
     * Returns <code>true</code> if this is the last page of matching {@link Tweet}s; <code>false</code> if there are more pages
     * that follow this one.
     */
    public boolean isLastPage() {
        return lastPage;
    }
} public class SimilarPlacesResponse {

    private final String token;

    private final List<Place> places;

    public SimilarPlacesResponse(List<Place> places, String token) {
        this.places = places;
        this.token = token;
    }

    /**
     * The list of places found in a similar places search.
     *
     * @return
     */
    public List<Place> getPlaces() {
        return places;
    }

    /**
     * A token that may be used to create a new place.
     */
    public String getToken() {
        return token;
    }
} public class SuggestionCategory {
    private final String name;

    private final String slug;

    private final int size;

    public SuggestionCategory(String name, String slug, int size) {
        this.name = name;
        this.slug = slug;
        this.size = size;
    }

    public String getName() {
        return name;
    }

    public String getSlug() {
        return slug;
    }

    public int getSize() {
        return size;
    }

} public class Trend {
    private final String name;

    private final String query;

    public Trend(String name, String query) {
        this.name = name;
        this.query = query;
    }

    public String getName() {
        return name;
    }

    public String getQuery() {
        return query;
    }

} public class Trends {
    private final Date time;

    private final List<Trend> trends;

    public Trends(Date time, List<Trend> trends) {
        this.time = time;
        this.trends = trends;
    }

    public Date getTime() {
        return time;
    }

    public List<Trend> getTrends() {
        return trends;
    }

} public class Tweet {
    private long id;

    private String text;

    private Date createdAt;

    private String fromUser;

    private String profileImageUrl;

    private Long toUserId;

    private Long inReplyToStatusId;

    private long fromUserId;

    private boolean favorited;

    private String languageCode;

    private String source;

    private Integer retweetCount;

    public Tweet(long id, String text, Date createdAt, String fromUser, String profileImageUrl, Long toUserId, long fromUserId,
                 String languageCode, String source) {
        this.id = id;
        this.text = text;
        this.createdAt = createdAt;
        this.fromUser = fromUser;
        this.profileImageUrl = profileImageUrl;
        this.toUserId = toUserId;
        this.fromUserId = fromUserId;
        this.languageCode = languageCode;
        this.source = source;
    }

    public String getText() {
        return text;
    }

    public void setText(String text) {
        this.text = text;
    }

    public Date getCreatedAt() {
        return createdAt;
    }

    public void setCreatedAt(Date createdAt) {
        this.createdAt = createdAt;
    }

    public String getFromUser() {
        return fromUser;
    }

    public void setFromUser(String fromUser) {
        this.fromUser = fromUser;
    }

    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    public String getProfileImageUrl() {
        return profileImageUrl;
    }

    public void setProfileImageUrl(String profileImageUrl) {
        this.profileImageUrl = profileImageUrl;
    }

    public Long getToUserId() {
        return toUserId;
    }

    public void setToUserId(Long toUserId) {
        this.toUserId = toUserId;
    }

    public long getFromUserId() {
        return fromUserId;
    }

    public void setInReplyToStatusId(Long inReplyToStatusId) {
        this.inReplyToStatusId = inReplyToStatusId;
    }

    public Long getInReplyToStatusId() {
        return inReplyToStatusId;
    }

    public void setFromUserId(long fromUserId) {
        this.fromUserId = fromUserId;
    }

    public String getLanguageCode() {
        return languageCode;
    }

    public void setLanguageCode(String languageCode) {
        this.languageCode = languageCode;
    }

    public String getSource() {
        return source;
    }

    public void setSource(String source) {
        this.source = source;
    }

    public void setRetweetCount(Integer retweetCount) {
        this.retweetCount = retweetCount;
    }

    /**
     * The number of times this tweet has been retweeted. Only available in timeline results. getRetweetCount() will return null
     * for Tweet objects returned in search results.
     */
    public Integer getRetweetCount() {
        return retweetCount;
    }

    /**
     * @return the favorited
     */
    public boolean isFavorited() {
        return favorited;
    }

    /**
     * @param favorited the favorited to set
     */
    public void setFavorited(boolean favorited) {
        this.favorited = favorited;
    }
} public class TwitterProfile extends UserProfile {

    private static final long serialVersionUID = -6675776414312067618L;

    private final String screenName;

    private final String name;

    private final String url;

    private final String profileImageUrl;

    private final String description;

    private final String location;

    private final Date createdDate;

    private String language;

    private int statusesCount;

    private int friendsCount;

    private int followersCount;

    private int favoritesCount;

    private int listedCount;

    private boolean following;

    private boolean followRequestSent;

    private boolean isProtected;

    private boolean notificationsEnabled;

    private boolean verified;

    private boolean geoEnabled;

    private boolean contributorsEnabled;

    private boolean translator;

    private String timeZone;

    private int utcOffset;

    private String sidebarBorderColor;

    private String sidebarFillColor;

    private String backgroundColor;

    private boolean useBackgroundImage;

    private String backgroundImageUrl;

    private boolean backgroundImageTiled;

    private String textColor;

    private String linkColor;

    private boolean showAllInlineMedia;

    public TwitterProfile(String id, String screenName, String name, String url, String profileImageUrl, String description,
            String location, Date createdDate) {
        super(id, Twitter.class);
        this.screenName = screenName;
        this.name = name;
        this.url = url;
        this.profileImageUrl = profileImageUrl;
        this.description = description;
        this.location = location;
        this.createdDate = createdDate;
    }

    /**
     * The user's Twitter screen name
     *
     * @return The user's Twitter screen name
     */
    public String getScreenName() {
        return screenName;
    }

    /**
     * The user's full name
     *
     * @return The user's full name
     */
    public String getName() {
        return name;
    }

    /**
     * The user's URL
     *
     * @return The user's URL
     */
    public String getUrl() {
        return url;
    }

    /**
     * The user's description
     *
     * @return The user's description
     */
    public String getDescription() {
        return description;
    }

    /**
     * The user's location
     *
     * @return The user's location
     */
    public String getLocation() {
        return location;
    }

    /**
     * <p>
     * The URL of the user's profile image in "normal" size (48x48).
     * </p>
     *
     * @return The URL of the user's normal-sized profile image.
     */
    @Override
    public String getProfileImageUrl() {
        return profileImageUrl;
    }

    /**
     * <p>
     * The URL of the user's profile.
     * </p>
     *
     * @return The URL of the user's profile.
     */
    public String getProfileUrl() {
        return "http://twitter.com/" + screenName;
    }

    /**
     * The date that the Twitter profile was created.
     *
     * @return The date that the Twitter profile was created.
     */
    public Date getCreatedDate() {
        return createdDate;
    }

    /**
     * Whether or not the user has mobile notifications enabled.
     */
    public boolean isNotificationsEnabled() {
        return notificationsEnabled;
    }

    /**
     * Whether or not the user is verified with Twitter. See
     * http://support.twitter.com/groups/31-twitter-basics/topics/111-features/articles/119135-about-verified-accounts.
     */
    public boolean isVerified() {
        return verified;
    }

    /**
     * Whether or not the user has enabled their account with geo location.
     */
    public boolean isGeoEnabled() {
        return geoEnabled;
    }

    /**
     * The user's preferred language.
     */
    public String getLanguage() {
        return language;
    }

    /**
     * The number of tweets this user has posted.
     */
    public int getStatusesCount() {
        return statusesCount;
    }

    /**
     * The number of lists the user is listed on.
     */
    public int getListedCount() {
        return listedCount;
    }

    /**
     * The number of friends the user has (the number of users this user follows).
     */
    public int getFriendsCount() {
        return friendsCount;
    }

    /**
     * The number of followers the user has.
     */
    public int getFollowersCount() {
        return followersCount;
    }

    /**
     * Whether or not the authenticated user is following this user.
     */
    public boolean isFollowing() {
        return following;
    }

    /**
     * Whether or not a request has been sent by the authenticating user to follow this user.
     */
    public boolean isFollowRequestSent() {
        return followRequestSent;
    }

    /**
     * The number of tweets that the user has marked as favorites.
     */
    public int getFavoritesCount() {
        return favoritesCount;
    }

    /**
     * Whether or not the user's tweets are protected.
     */
    public boolean isProtected() {
        return isProtected;
    }

    /**
     * The user's time zone.
     */
    public String getTimeZone() {
        return timeZone;
    }

    /**
     * The user's UTC offset in seconds.
     */
    public int getUtcOffset() {
        return utcOffset;
    }

    /**
     * Whether or not this profile is enabled for contributors.
     */
    public boolean isContributorsEnabled() {
        return contributorsEnabled;
    }

    /**
     * Whether or not this user is a translator.
     */
    public boolean isTranslator() {
        return translator;
    }

    /**
     * The color of the sidebar border on the user's Twitter profile page.
     */
    public String getSidebarBorderColor() {
        return sidebarBorderColor;
    }

    /**
     * The color of the sidebar fill on the user's Twitter profile page.
     */
    public String getSidebarFillColor() {
        return sidebarFillColor;
    }

    /**
     * The color of the background of the user's Twitter profile page.
     */
    public String getBackgroundColor() {
        return backgroundColor;
    }

    /**
     * Whether or not the user's Twitter profile page uses a background image.
     */
    public boolean useBackgroundImage() {
        return useBackgroundImage;
    }

    /**
     * The URL to a background image shown on the user's Twitter profile page.
     */
    public String getBackgroundImageUrl() {
        return backgroundImageUrl;
    }

    /**
     * Whether or not the background image is tiled.
     */
    public boolean isBackgroundImageTiled() {
        return backgroundImageTiled;
    }

    /**
     * The text color on the user's Twitter profile page.
     */
    public String getTextColor() {
        return textColor;
    }

    /**
     * The link color on the user's Twitter profile page.
     */
    public String getLinkColor() {
        return linkColor;
    }

    /**
     * Whether or not the user has selected to see all inline media from everyone. If false, they will only see inline media
     * from the users they follow.
     */
    public boolean showAllInlineMedia() {
        return showAllInlineMedia;
    }

    @Override
    public String getLoginName() {
        return getScreenName();
    }

    @Override
    public String getFullName() {
        return getName();
    }

    @Override
    public String getFirstName() {
        return getName();
    }

    @Override
    public String getLastName() {
        return getScreenName();
    }

    @Override
    public String getEmail() {
        return "";
    }

} public class UserList {
    private final long id;

    private final String name;

    private final String fullName;

    private final String uriPath;

    private final String description;

    private final String slug;

    private final boolean isPublic;

    private final boolean isFollowing;

    private final int memberCount;

    private final int subscriberCount;

    public UserList(long id, String name, String fullName, String uriPath, String description, String slug, boolean isPublic,
                    boolean isFollowing, int memberCount, int subscriberCount) {
        this.id = id;
        this.name = name;
        this.fullName = fullName;
        this.uriPath = uriPath;
        this.description = description;
        this.slug = slug;
        this.isPublic = isPublic;
        this.isFollowing = isFollowing;
        this.memberCount = memberCount;
        this.subscriberCount = subscriberCount;
    }

    public long getId() {
        return id;
    }

    public String getName() {
        return name;
    }

    public String getFullName() {
        return fullName;
    }

    public String getUriPath() {
        return uriPath;
    }

    public String getDescription() {
        return description;
    }

    public String getSlug() {
        return slug;
    }

    public boolean isPublic() {
        return isPublic;
    }

    public boolean isFollowing() {
        return isFollowing;
    }

    public int getMemberCount() {
        return memberCount;
    }

    public int getSubscriberCount() {
        return subscriberCount;
    }

}
import org.agorava.twitter.model.UserList;
import com.fasterxml.jackson.databind.module.SimpleModule;
import org.agorava.twitter.Twitter;
import org.agorava.twitter.model.DirectMessage;
import org.agorava.twitter.model.Place;
import org.agorava.twitter.model.RateLimitStatus;
import org.agorava.twitter.model.SavedSearch;
import org.agorava.twitter.model.SearchResults;
import org.agorava.twitter.model.SimilarPlacesResponse;
import org.agorava.twitter.model.SuggestionCategory;
import org.agorava.twitter.model.Trend;
import org.agorava.twitter.model.Trends;
import org.agorava.twitter.model.Tweet;
import org.agorava.twitter.model.TwitterProfile;
/*
 * Copyright 2016 Agorava
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.agorava.twitter.jackson;



/**
 * Jackson module for registering mixin annotations against Twitter model classes.
 *
 * @author Craig Walls
 * @author Antoine Sabot-Durand
 * @author Werner Keil
 */

@SuppressWarnings("serial")
@Twitter
class TwitterModule extends SimpleModule {
    public TwitterModule() {
        super("TwitterModule");
    }

    @Override
    public void setupModule(SetupContext context) {
        context.setMixInAnnotations(TwitterProfile.class, TwitterProfileMixin.class);
        context.setMixInAnnotations(SavedSearch.class, SavedSearchMixin.class);