diff options
author | Vitaly Takmazov | 2016-01-10 19:58:19 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2016-01-10 19:58:19 +0300 |
commit | 331363c89936be9df126d10e16107b99a18877d1 (patch) | |
tree | 1f718009e09b4078c7fe09651dbe0050abc62131 /src/main/java/com/juick/json/MessageSerializer.java | |
parent | c152ab72d3ba8f662706eb4b1342d839762a243a (diff) |
refactoring
Diffstat (limited to 'src/main/java/com/juick/json/MessageSerializer.java')
-rw-r--r-- | src/main/java/com/juick/json/MessageSerializer.java | 20 |
1 files changed, 10 insertions, 10 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); |