aboutsummaryrefslogtreecommitdiff
path: root/juick-api/src/main/java/com/juick/api/TGBot.java
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2016-11-28 14:49:47 +0300
committerGravatar Vitaly Takmazov2016-11-28 14:49:47 +0300
commitb4225fa075eef58924399f2c5f7a117ee171c2c6 (patch)
treeb952f22ae76467da3ee8bbe79b4f9accd9a0e599 /juick-api/src/main/java/com/juick/api/TGBot.java
parent5b2bd7f928bbf9d3233ff029ed5c09ac46daf0de (diff)
configure json serialization properties
Diffstat (limited to 'juick-api/src/main/java/com/juick/api/TGBot.java')
-rw-r--r--juick-api/src/main/java/com/juick/api/TGBot.java10
1 files changed, 9 insertions, 1 deletions
diff --git a/juick-api/src/main/java/com/juick/api/TGBot.java b/juick-api/src/main/java/com/juick/api/TGBot.java
index 882dc821..e0ab3e1e 100644
--- a/juick-api/src/main/java/com/juick/api/TGBot.java
+++ b/juick-api/src/main/java/com/juick/api/TGBot.java
@@ -1,5 +1,6 @@
package com.juick.api;
+import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.juick.service.MessagesService;
import com.juick.service.TelegramService;
@@ -35,19 +36,26 @@ public class TGBot implements AutoCloseable {
TelegramBot bot;
WebSocket ws;
- ObjectMapper ms = new ObjectMapper();
+ private ObjectMapper ms;
@Inject
TelegramService telegramService;
@Inject
MessagesService messagesService;
+ private TGBot() {
+ throw new IllegalStateException();
+ }
public TGBot(String token) {
if (StringUtils.isBlank(token)) {
return;
}
bot = TelegramBotAdapter.build(token);
+ ms = new ObjectMapper();
+ ms.setSerializationInclusion(JsonInclude.Include.NON_EMPTY);
+ ms.setSerializationInclusion(JsonInclude.Include.NON_NULL);
+ ms.setSerializationInclusion(JsonInclude.Include.NON_DEFAULT);
try {
SetWebhook webhook = new SetWebhook().url("https://api.juick.com/tlgmbtwbhk");
if (!bot.execute(webhook).isOk()) {