浏览代码

jfinal 4.9

James 5 年之前
父节点
当前提交
b6af5e9b36
共有 1 个文件被更改,包括 4 次插入4 次删除
  1. 4 4
      src/main/java/com/jfinal/json/JFinalJsonKit.java

+ 4 - 4
src/main/java/com/jfinal/json/JFinalJsonKit.java

@@ -47,7 +47,7 @@ public class JFinalJsonKit {
 	public static final JFinalJsonKit me = new JFinalJsonKit();
 	
 	// 缓存 ToJson 对象
-	protected static SyncWriteMap<Class<?>, ToJson<?>> map = new SyncWriteMap<>(512, 0.25F);
+	protected static SyncWriteMap<Class<?>, ToJson<?>> cache = new SyncWriteMap<>(512, 0.25F);
 	
 	// StringBuilder 最大缓冲区大小
 	protected static int maxBufferSize = 1024 * 512;
@@ -63,10 +63,10 @@ public class JFinalJsonKit {
 	}
 	
 	public ToJson<?> getToJson(Object object) {
-		ToJson<?> ret = map.get(object.getClass());
+		ToJson<?> ret = cache.get(object.getClass());
 		if (ret == null) {
 			ret = createToJson(object);
-			map.putIfAbsent(object.getClass(), ret);
+			cache.putIfAbsent(object.getClass(), ret);
 		}
 		return ret;
 	}
@@ -88,7 +88,7 @@ public class JFinalJsonKit {
 	public static void addToJson(Class<?> type, ToJson<?> toJson) {
 		Objects.requireNonNull(type, "type can not be null");
 		Objects.requireNonNull(toJson, "toJson can not be null");
-		map.put(type, toJson);
+		cache.put(type, toJson);
 	}
 	
 	protected ToJson<?> createToJson(Object value) {