@SuppressWarnings("rawtypes") @Test public void serialize() throws IOException { String value = "{\"uid\": {\"deletedAt\": 10, \"columns\": [[\"cell\",\"00000002\",1312400480243000], [\"enabled\",\"59\",1312400475129004], [\"newcolumn\",\"59\",1312400533649004]]}}"; Map<String, Object> map = new AegisthusSerializer().deserialize(value); Assert.assertEquals(s(map.get(AegisthusSerializer.KEY)), "uid"); Assert.assertEquals(map.get(AegisthusSerializer.DELETEDAT), 10L); Assert.assertEquals(s(((List) map.get("enabled")).get(1)), "59"); Assert.assertEquals(AegisthusSerializer.serialize(map), value); }
public static String serialize(Map<String, Object> data) { StringBuilder str = new StringBuilder(); str.append("{"); insertKey(str, data.remove(KEY)); str.append("{"); insertKey(str, "deletedAt"); str.append(data.remove(DELETEDAT)); str.append(", "); insertKey(str, "columns"); str.append("["); serializeColumns(str, data); str.append("]"); str.append("}}"); return str.toString(); }
AegisthusSerializer { public static String serialize(Map<String, Object> data) { StringBuilder str = new StringBuilder(); str.append("{"); insertKey(str, data.remove(KEY)); str.append("{"); insertKey(str, "deletedAt"); str.append(data.remove(DELETEDAT)); str.append(", "); insertKey(str, "columns"); str.append("["); serializeColumns(str, data); str.append("]"); str.append("}}"); return str.toString(); } }
AegisthusSerializer { public static String serialize(Map<String, Object> data) { StringBuilder str = new StringBuilder(); str.append("{"); insertKey(str, data.remove(KEY)); str.append("{"); insertKey(str, "deletedAt"); str.append(data.remove(DELETEDAT)); str.append(", "); insertKey(str, "columns"); str.append("["); serializeColumns(str, data); str.append("]"); str.append("}}"); return str.toString(); }  }
AegisthusSerializer { public static String serialize(Map<String, Object> data) { StringBuilder str = new StringBuilder(); str.append("{"); insertKey(str, data.remove(KEY)); str.append("{"); insertKey(str, "deletedAt"); str.append(data.remove(DELETEDAT)); str.append(", "); insertKey(str, "columns"); str.append("["); serializeColumns(str, data); str.append("]"); str.append("}}"); return str.toString(); }  Object type(String value); Map<String, Object> deserialize(String data); static String serialize(Map<String, Object> data); }
AegisthusSerializer { public static String serialize(Map<String, Object> data) { StringBuilder str = new StringBuilder(); str.append("{"); insertKey(str, data.remove(KEY)); str.append("{"); insertKey(str, "deletedAt"); str.append(data.remove(DELETEDAT)); str.append(", "); insertKey(str, "columns"); str.append("["); serializeColumns(str, data); str.append("]"); str.append("}}"); return str.toString(); }  Object type(String value); Map<String, Object> deserialize(String data); static String serialize(Map<String, Object> data); static String DELETEDAT; static String KEY; }