|
|
@@ -16,8 +16,10 @@
|
|
|
|
|
|
package com.jfinal.json;
|
|
|
|
|
|
+import java.lang.reflect.Type;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.parser.ParserConfig;
|
|
|
+import com.alibaba.fastjson.serializer.ObjectSerializer;
|
|
|
import com.alibaba.fastjson.serializer.SerializeConfig;
|
|
|
import com.alibaba.fastjson.serializer.SerializerFeature;
|
|
|
import com.jfinal.plugin.activerecord.Record;
|
|
|
@@ -52,6 +54,14 @@ public class FastJson extends Json {
|
|
|
public <T> T parse(String jsonString, Class<T> type) {
|
|
|
return JSON.parseObject(jsonString, type);
|
|
|
}
|
|
|
+
|
|
|
+ public static void setSafeMode(boolean safeMode) {
|
|
|
+ ParserConfig.getGlobalInstance().setSafeMode(safeMode);
|
|
|
+ }
|
|
|
+
|
|
|
+ public static void addSerializer(Type type, ObjectSerializer value) {
|
|
|
+ SerializeConfig.getGlobalInstance().put(type, value);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
|