diff options
author | Peter Wu <peter@lekensteyn.nl> | 2014-05-09 23:03:09 +0200 |
---|---|---|
committer | Peter Wu <peter@lekensteyn.nl> | 2014-05-09 23:03:09 +0200 |
commit | 34c600891613280e41cfd1ec1ad1bee8f23d043a (patch) | |
tree | 5d08b0673ff939d5bb066b4ac488c7623a86b1cf /src/data/Tweet.java | |
parent | 9be617801a8dabe4bcae017c2f671c5c10b3aebb (diff) | |
download | Datafiller-34c600891613280e41cfd1ec1ad1bee8f23d043a.tar.gz |
Entities can be missing, user.place is not a string
* User: place is not a string but a Place object.
* User: entities is nullable.
* Tweet: in_reply_to_user_id, coordinates is nullable.
* ValidatingJsonDeserializer: Treat null values as missing fields.
* ValidatingJsonDeserializerTest: Test for null values.
Diffstat (limited to 'src/data/Tweet.java')
-rw-r--r-- | src/data/Tweet.java | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/data/Tweet.java b/src/data/Tweet.java index 67292ec..384a9e1 100644 --- a/src/data/Tweet.java +++ b/src/data/Tweet.java @@ -10,10 +10,14 @@ public class Tweet { public long id; public String lang; + @ValidatingJsonDeserializer.Nullable public long in_reply_to_user_id; public String created_at; public long favorite_count; - public String place; + @ValidatingJsonDeserializer.Nullable + @ValidatingJsonDeserializer.Validator + public Place place; + @ValidatingJsonDeserializer.Nullable public String coordinates; public String text; @ValidatingJsonDeserializer.Nullable @@ -31,6 +35,16 @@ public class Tweet { return gson.toJson(this); } + public static class Place { + + //public String id; // "a5b6bdd8008412b1" + //public String name; // "Danbury" + //public String country_code; // "US" + public String country; // "United States" + //public String url; // "https://api.twitter.com/1.1/geo/id/a5b6bdd8008412b1.json" + public String full_name; // "Danbury, CT" + } + public static class Entities { @ValidatingJsonDeserializer.Validator |