miemie 5 lat temu
rodzic
commit
35063f0654

+ 5 - 5
mybatis-plus-extension/src/main/java/com/baomidou/mybatisplus/extension/handlers/GsonTypeHandler.java

@@ -43,11 +43,6 @@ public class GsonTypeHandler extends AbstractJsonTypeHandler<Object> {
         this.type = type;
     }
 
-    public static void setGson(Gson gson) {
-        Assert.notNull(gson, "Gson should not be null");
-        GsonTypeHandler.gson = gson;
-    }
-
     @Override
     protected Object parse(String json) {
         return gson.fromJson(json, type);
@@ -57,4 +52,9 @@ public class GsonTypeHandler extends AbstractJsonTypeHandler<Object> {
     protected String toJson(Object obj) {
         return gson.toJson(obj);
     }
+
+    public static void setGson(Gson gson) {
+        Assert.notNull(gson, "Gson should not be null");
+        GsonTypeHandler.gson = gson;
+    }
 }

+ 5 - 5
mybatis-plus-extension/src/main/java/com/baomidou/mybatisplus/extension/handlers/JacksonTypeHandler.java

@@ -46,11 +46,6 @@ public class JacksonTypeHandler extends AbstractJsonTypeHandler<Object> {
         this.type = type;
     }
 
-    public static void setObjectMapper(ObjectMapper objectMapper) {
-        Assert.notNull(objectMapper, "ObjectMapper should not be null");
-        JacksonTypeHandler.objectMapper = objectMapper;
-    }
-
     @Override
     protected Object parse(String json) {
         try {
@@ -68,4 +63,9 @@ public class JacksonTypeHandler extends AbstractJsonTypeHandler<Object> {
             throw new RuntimeException(e);
         }
     }
+
+    public static void setObjectMapper(ObjectMapper objectMapper) {
+        Assert.notNull(objectMapper, "ObjectMapper should not be null");
+        JacksonTypeHandler.objectMapper = objectMapper;
+    }
 }