From 54a3fad3490ae3d9f03e934895743326b86ddf29 Mon Sep 17 00:00:00 2001 From: Fabian Schlenz Date: Thu, 23 Feb 2017 06:17:58 +0100 Subject: [PATCH] Message now caches the message. --- .../java/de/fabianonline/telegram_backup/models/Message.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/de/fabianonline/telegram_backup/models/Message.java b/src/main/java/de/fabianonline/telegram_backup/models/Message.java index ecab8b3..942e861 100644 --- a/src/main/java/de/fabianonline/telegram_backup/models/Message.java +++ b/src/main/java/de/fabianonline/telegram_backup/models/Message.java @@ -7,6 +7,7 @@ import com.google.gson.JsonObject; public class Message { protected static String tableName = "messages"; private JsonObject json; + private String message = null; public Message(String json) { this.json = new JsonParser().parse(json).getAsJsonObject(); @@ -18,6 +19,7 @@ public class Message { } public String getMessage() { - return json.getAsJsonPrimitive("message").getAsString(); + if (message != null) return message; + return message = json.getAsJsonPrimitive("message").getAsString(); } }