diff options
author | Vitaly Takmazov | 2016-07-12 17:51:27 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2016-07-12 17:51:27 +0300 |
commit | f04b1c21e42525377d01b5d102006ae4efe5d4b1 (patch) | |
tree | 1d9f9d00765049adff2319bdb8f2f3fa7ac2a0ba /juick-core/src | |
parent | bdbf65e0a50758bfcc88e1cc9c501eeed4e7e45d (diff) |
jackson-databind serialization with tests
Diffstat (limited to 'juick-core/src')
-rw-r--r-- | juick-core/src/main/java/com/juick/Message.java | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/juick-core/src/main/java/com/juick/Message.java b/juick-core/src/main/java/com/juick/Message.java index 2b66e667..cb5fe92e 100644 --- a/juick-core/src/main/java/com/juick/Message.java +++ b/juick-core/src/main/java/com/juick/Message.java @@ -17,6 +17,8 @@ */ package com.juick; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; import java.util.*; @@ -36,6 +38,7 @@ public class Message implements Comparable { public int ReplyTo = 0; private String Text = null; private User User = null; + @JsonProperty("tags") public List<Tag> Tags = new ArrayList<>(); private Date date; public int TimeAgo = 0; @@ -157,7 +160,7 @@ public class Message implements Comparable { return null; } } - + @JsonIgnore public String getTagsString() { String ret = ""; if (!Tags.isEmpty()) { @@ -209,6 +212,7 @@ public class Message implements Comparable { User = user; } + @JsonProperty("body") public String getText() { return Text; } @@ -217,6 +221,8 @@ public class Message implements Comparable { Text = text; } + @JsonProperty("timestamp") + @JsonFormat(shape= JsonFormat.Shape.STRING, pattern="yyyy-MM-dd HH:mm:ss", timezone="UTC") public Date getDate() { return date; } |