aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2015-11-04 14:19:11 +0300
committerGravatar Vitaly Takmazov2015-11-04 14:19:11 +0300
commitc3d949e11a4380a2353fca0abf12292285fde02c (patch)
tree3046cf5c2bc83e803fecc8ec6f400f216b536201
parentc98f2e946babbec6b0174e175f49e9cd353223e2 (diff)
initial gson support
-rw-r--r--build.gradle1
-rw-r--r--src/main/java/com/juick/Message.java7
-rw-r--r--src/test/java/com/juick/tests/MessageTests.java2
3 files changed, 10 insertions, 0 deletions
diff --git a/build.gradle b/build.gradle
index c973749c..397234a6 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,5 +1,6 @@
apply plugin: "java"
dependencies {
+ compile 'com.google.code.gson:gson:2.4'
testCompile 'junit:junit:4.12'
}
diff --git a/src/main/java/com/juick/Message.java b/src/main/java/com/juick/Message.java
index 4db2620e..c87bf445 100644
--- a/src/main/java/com/juick/Message.java
+++ b/src/main/java/com/juick/Message.java
@@ -17,6 +17,8 @@
*/
package com.juick;
+import com.google.gson.annotations.SerializedName;
+
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
@@ -27,8 +29,13 @@ import java.util.Date;
*/
public class Message {
+ @SerializedName("mid")
public int MID = 0;
+
+ @SerializedName("rid")
public int RID = 0;
+
+ @SerializedName("replyto")
public int ReplyTo = 0;
public String Text = null;
public User User = null;
diff --git a/src/test/java/com/juick/tests/MessageTests.java b/src/test/java/com/juick/tests/MessageTests.java
index 47b2d13c..0392c7b3 100644
--- a/src/test/java/com/juick/tests/MessageTests.java
+++ b/src/test/java/com/juick/tests/MessageTests.java
@@ -1,3 +1,5 @@
+package com.juick.tests;
+
import static org.junit.Assert.assertEquals;
import org.junit.Test;