mirror of
https://gitee.com/BDWare/cp.git
synced 2025-01-10 01:44:08 +00:00
feat: use tools
use JsonUtil to replace JsonParser
This commit is contained in:
parent
18f40dc6a9
commit
9039930340
@ -34,10 +34,7 @@ public class MemoryDump implements Serializable {
|
||||
}
|
||||
|
||||
public static MemoryDump loadFromStr(String memDump) {
|
||||
JsonElement jo = new com.google.gson.JsonParser().parse(memDump);
|
||||
// JsonElement objs = jo.getAsJsonObject().get("objects");
|
||||
// JsonObject map = objs.getAsJsonObject();
|
||||
JsonObject map = jo.getAsJsonObject();
|
||||
JsonObject map = JsonUtil.parseString(memDump);
|
||||
MemoryDump ret = new MemoryDump();
|
||||
for (Entry<String, JsonElement> entry : map.entrySet()) {
|
||||
long id = Long.parseLong(entry.getKey());
|
||||
@ -66,7 +63,7 @@ public class MemoryDump implements Serializable {
|
||||
mo = JsonUtil.fromJson(obj, MemoryObject.class);
|
||||
break;
|
||||
default:
|
||||
System.out.println("[MemoryDump] todo, missing type:" + type.toString());
|
||||
System.out.println("[MemoryDump] todo, missing type:" + type);
|
||||
break;
|
||||
}
|
||||
ret.objects.put(id, mo);
|
||||
@ -221,7 +218,7 @@ public class MemoryDump implements Serializable {
|
||||
obj = Double.parseDouble(mo.data.toString());
|
||||
break;
|
||||
default:
|
||||
System.out.println("[MemoryDump] todo, missing type:" + mo.type.toString());
|
||||
System.out.println("[MemoryDump] todo, missing type:" + mo.type);
|
||||
break;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user