@Test @UseDataProvider("values") public void serializeColumns(List<Object> values, String exp) { Map<String, Object> map = Maps.newHashMap(); map.put(values.get(0).toString(), values); StringBuilder sb = new StringBuilder(); AegisthusSerializer.serializeColumns(sb, map); Assert.assertEquals(sb.toString(), exp); }
protected static void serializeColumns(StringBuilder sb, Map<String, Object> columns) { int count = 0; for (Map.Entry<String, Object> e : columns.entrySet()) { if (count++ > 0) { sb.append(", "); } @SuppressWarnings("unchecked") List<Object> list = (List<Object>) e.getValue(); sb.append("["); sb.append("\"").append(((String) list.get(0)).replace("\\", "\\\\").replace("\"", "\\\"")).append("\"").append(","); sb.append("\"").append(list.get(1)).append("\"").append(","); sb.append(list.get(2)); if (list.size() > 3) { sb.append(",").append("\"").append(list.get(3)).append("\""); } for (int i = 4; i < list.size(); i++) { sb.append(",").append(list.get(i)); } sb.append("]"); } }
AegisthusSerializer { protected static void serializeColumns(StringBuilder sb, Map<String, Object> columns) { int count = 0; for (Map.Entry<String, Object> e : columns.entrySet()) { if (count++ > 0) { sb.append(", "); } @SuppressWarnings("unchecked") List<Object> list = (List<Object>) e.getValue(); sb.append("["); sb.append("\"").append(((String) list.get(0)).replace("\\", "\\\\").replace("\"", "\\\"")).append("\"").append(","); sb.append("\"").append(list.get(1)).append("\"").append(","); sb.append(list.get(2)); if (list.size() > 3) { sb.append(",").append("\"").append(list.get(3)).append("\""); } for (int i = 4; i < list.size(); i++) { sb.append(",").append(list.get(i)); } sb.append("]"); } } }
AegisthusSerializer { protected static void serializeColumns(StringBuilder sb, Map<String, Object> columns) { int count = 0; for (Map.Entry<String, Object> e : columns.entrySet()) { if (count++ > 0) { sb.append(", "); } @SuppressWarnings("unchecked") List<Object> list = (List<Object>) e.getValue(); sb.append("["); sb.append("\"").append(((String) list.get(0)).replace("\\", "\\\\").replace("\"", "\\\"")).append("\"").append(","); sb.append("\"").append(list.get(1)).append("\"").append(","); sb.append(list.get(2)); if (list.size() > 3) { sb.append(",").append("\"").append(list.get(3)).append("\""); } for (int i = 4; i < list.size(); i++) { sb.append(",").append(list.get(i)); } sb.append("]"); } }  }
AegisthusSerializer { protected static void serializeColumns(StringBuilder sb, Map<String, Object> columns) { int count = 0; for (Map.Entry<String, Object> e : columns.entrySet()) { if (count++ > 0) { sb.append(", "); } @SuppressWarnings("unchecked") List<Object> list = (List<Object>) e.getValue(); sb.append("["); sb.append("\"").append(((String) list.get(0)).replace("\\", "\\\\").replace("\"", "\\\"")).append("\"").append(","); sb.append("\"").append(list.get(1)).append("\"").append(","); sb.append(list.get(2)); if (list.size() > 3) { sb.append(",").append("\"").append(list.get(3)).append("\""); } for (int i = 4; i < list.size(); i++) { sb.append(",").append(list.get(i)); } sb.append("]"); } }  Object type(String value); Map<String, Object> deserialize(String data); static String serialize(Map<String, Object> data); }
AegisthusSerializer { protected static void serializeColumns(StringBuilder sb, Map<String, Object> columns) { int count = 0; for (Map.Entry<String, Object> e : columns.entrySet()) { if (count++ > 0) { sb.append(", "); } @SuppressWarnings("unchecked") List<Object> list = (List<Object>) e.getValue(); sb.append("["); sb.append("\"").append(((String) list.get(0)).replace("\\", "\\\\").replace("\"", "\\\"")).append("\"").append(","); sb.append("\"").append(list.get(1)).append("\"").append(","); sb.append(list.get(2)); if (list.size() > 3) { sb.append(",").append("\"").append(list.get(3)).append("\""); } for (int i = 4; i < list.size(); i++) { sb.append(",").append(list.get(i)); } sb.append("]"); } }  Object type(String value); Map<String, Object> deserialize(String data); static String serialize(Map<String, Object> data); static String DELETEDAT; static String KEY; }