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