diff options
Diffstat (limited to 'src/main/java/com')
-rw-r--r-- | src/main/java/com/juick/json/MessageSerializer.java | 20 | ||||
-rw-r--r-- | src/main/java/com/juick/json/UserSerializer.java | 22 |
2 files changed, 21 insertions, 21 deletions
diff --git a/src/main/java/com/juick/json/MessageSerializer.java b/src/main/java/com/juick/json/MessageSerializer.java index 0879f13a..85986415 100644 --- a/src/main/java/com/juick/json/MessageSerializer.java +++ b/src/main/java/com/juick/json/MessageSerializer.java @@ -38,9 +38,9 @@ public class MessageSerializer extends JSONSerializer<Message> { @Override public Message deserialize(JSONObject json) throws JSONException { com.juick.Message jmsg = new com.juick.Message(); - jmsg.MID = json.getInt("mid"); + jmsg.setMID(json.getInt("mid")); if (json.has("rid")) { - jmsg.RID = json.getInt("rid"); + jmsg.setRID(json.getInt("rid")); } if (json.has("replyto")) { jmsg.ReplyTo = json.getInt("replyto"); @@ -50,7 +50,7 @@ public class MessageSerializer extends JSONSerializer<Message> { jmsg.ReadOnly = json.has("readonly"); jmsg.Text = json.getString("body").replace(""", "\""); - jmsg.User = userSerializer.deserialize(json.getJSONObject("user")); + jmsg.setUser(userSerializer.deserialize(json.getJSONObject("user"))); try { DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); @@ -82,11 +82,11 @@ public class MessageSerializer extends JSONSerializer<Message> { JSONObject json = new JSONObject(); try { - if (msg.MID > 0) { - json.put("mid", msg.MID); + if (msg.getMID() > 0) { + json.put("mid", msg.getMID()); } - if (msg.RID > 0) { - json.put("rid", msg.RID); + if (msg.getRID() > 0) { + json.put("rid", msg.getRID()); } if (msg.ReplyTo > 0) { json.put("replyto", msg.ReplyTo); @@ -105,8 +105,8 @@ public class MessageSerializer extends JSONSerializer<Message> { } else if (msg.TimestampString != null) { json.put("timestamp", msg.TimestampString); } - if (msg.User != null) { - json.put("user", userSerializer.serialize(msg.User)); + if (msg.getUser() != null) { + json.put("user", userSerializer.serialize(msg.getUser())); } if (msg.Tags != null && msg.Tags.size() > 0) { json.put("tags", new JSONArray(msg.Tags)); @@ -118,7 +118,7 @@ public class MessageSerializer extends JSONSerializer<Message> { json.put("place", placeSerializer.serialize(msg.Place)); } if (msg.AttachmentType != null) { - String fname = msg.MID + (msg.RID > 0 ? "-" + msg.RID : "") + "." + msg.AttachmentType; + String fname = msg.getMID() + (msg.getRID() > 0 ? "-" + msg.getRID() : "") + "." + msg.AttachmentType; JSONObject photo = new JSONObject(); photo.put("thumbnail", "http://i.juick.com/ps/" + fname); photo.put("small", "http://i.juick.com/photos-512/" + fname); diff --git a/src/main/java/com/juick/json/UserSerializer.java b/src/main/java/com/juick/json/UserSerializer.java index 07f87616..4485812a 100644 --- a/src/main/java/com/juick/json/UserSerializer.java +++ b/src/main/java/com/juick/json/UserSerializer.java @@ -30,10 +30,10 @@ public class UserSerializer extends JSONSerializer<User> { @Override public User deserialize(JSONObject json) throws JSONException { User juser = new User(); - juser.UID = json.getInt("uid"); - juser.UName = json.getString("uname"); + juser.setUID(json.getInt("uid")); + juser.setUName(json.getString("uname")); if (json.has("fullname")) { - juser.FullName = json.getString("fullname"); + juser.setFullName(json.getString("fullname")); } return juser; } @@ -43,17 +43,17 @@ public class UserSerializer extends JSONSerializer<User> { JSONObject json = new JSONObject(); try { - if (user.UID > 0) { - json.put("uid", user.UID); + if (user.getUID() > 0) { + json.put("uid", user.getUID()); } - if (user.UName != null) { - json.put("uname", user.UName); + if (user.getUName() != null) { + json.put("uname", user.getUName()); } - if (user.FullName != null) { - json.put("fullname", user.FullName); + if (user.getFullName() != null) { + json.put("fullname", user.getFullName()); } - if (user.JID != null) { - json.put("jid", user.JID); + if (user.getJID() != null) { + json.put("jid", user.getJID()); } if (user.MessagesCount > 0) { json.put("MessagesCount", user.MessagesCount); |