From a5ed284658d70875e74c4c8ca2924de933e7d9af Mon Sep 17 00:00:00 2001 From: xiaoQQya Date: Sat, 4 Feb 2023 18:13:47 +0800 Subject: [PATCH] =?UTF-8?q?fix(JsonUtil):=20=E4=BF=AE=E5=A4=8D=20Redis=20?= =?UTF-8?q?=E4=B8=AD=20Object=20=E5=BA=8F=E5=88=97=E5=8C=96=E4=B8=8E?= =?UTF-8?q?=E5=8F=8D=E5=BA=8F=E5=88=97=E5=8C=96=E4=B8=8D=E4=B8=80=E8=87=B4?= =?UTF-8?q?=E5=AF=BC=E8=87=B4=E6=8A=A5=E9=94=99=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/genersoft/iot/vmp/utils/JsonUtil.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/genersoft/iot/vmp/utils/JsonUtil.java b/src/main/java/com/genersoft/iot/vmp/utils/JsonUtil.java index 6ae56347..60e2dbe2 100644 --- a/src/main/java/com/genersoft/iot/vmp/utils/JsonUtil.java +++ b/src/main/java/com/genersoft/iot/vmp/utils/JsonUtil.java @@ -27,11 +27,10 @@ public final class JsonUtil { * @return result type */ public static T redisJsonToObject(String key, Class clazz) { - JSONObject jsonObject = (JSONObject) RedisUtil.get(key); + Object jsonObject = RedisUtil.get(key); if (Objects.isNull(jsonObject)) { return null; } - return JSON.parseObject(jsonObject.toJSONString(), clazz); + return clazz.cast(jsonObject); } - } \ No newline at end of file