From 66e6a90a81dacbf15ac2cb8864886b499812cba6 Mon Sep 17 00:00:00 2001 From: YuTian <2953516620@qq.com> Date: Wed, 17 Jul 2024 16:08:21 +0800 Subject: [PATCH] v1.3.4 --- .../com/io/yutian/aulib/serialize/SerializeHelper.java | 8 +++++--- src/main/resources/plugin.yml | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/io/yutian/aulib/serialize/SerializeHelper.java b/src/main/java/com/io/yutian/aulib/serialize/SerializeHelper.java index d93ce20..0ea423c 100644 --- a/src/main/java/com/io/yutian/aulib/serialize/SerializeHelper.java +++ b/src/main/java/com/io/yutian/aulib/serialize/SerializeHelper.java @@ -64,7 +64,7 @@ public class SerializeHelper { continue; } Object deserializeValue = deserializeValue(field, field.getType(), value); - field.set(instance, deserializeValue); + ReflectionUtil.setFieldUsingUnsafe(field, instance, deserializeValue); } return instance; } catch (Exception e) { @@ -116,8 +116,9 @@ public class SerializeHelper { map.put(key, deserializeValue(field, valueType, jsonObject.get(key))); } return map; + } else { + return deserialize(clazz, (JSONObject) value); } - return null; } private static Object serializeValue(Object value) throws SerializeException { @@ -159,8 +160,9 @@ public class SerializeHelper { jsonObject.put(key.toString(), serializeValue(map.get(key))); } return jsonObject; + } else { + return serialize(value); } - return null; } public static final Map, Class> WRAPPER_TO_PRIMITIVE = new HashMap<>(); diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 97866b3..3c4df09 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,4 +1,4 @@ name: AuLib main: com.io.yutian.aulib.AuLib -version: 1.3.2 +version: 1.3.4 author: SuperYuTian \ No newline at end of file