summaryrefslogtreecommitdiff
path: root/src/data/Tweet.java
blob: 67292ec9c13bf7a1c1bf6c1bca87991fe6331145 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
package data;

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;

/**
 * Represents the tweet object as returned by the twitter API.
 */
public class Tweet {

    public long id;
    public String lang;
    public long in_reply_to_user_id;
    public String created_at;
    public long favorite_count;
    public String place;
    public String coordinates;
    public String text;
    @ValidatingJsonDeserializer.Nullable
    @ValidatingJsonDeserializer.Validator
    public Tweet retweeted_status;
    @ValidatingJsonDeserializer.Validator
    public Entities entities;
    public long retweet_count;
    @ValidatingJsonDeserializer.Validator
    public User user;

    @Override
    public String toString() {
        Gson gson = new GsonBuilder().setPrettyPrinting().create();
        return gson.toJson(this);
    }

    public static class Entities {

        @ValidatingJsonDeserializer.Validator
        public Hashtag[] hashtags;
        @ValidatingJsonDeserializer.Validator
        public Url[] urls;
        @ValidatingJsonDeserializer.Validator
        public Mention[] user_mentions;
    }

    public static class Hashtag {

        public String text;
    }

    public static class Url {

        public String expanded_url;
        //public String display_url;
        //public String url;
    }

    public static class Mention {

        public long id; // user ID
        //public String name; // display name
        //public String screen_name; // Screen name (at-name)
    }
}