@Test public void testSerialisation() { Feature[] features = { new Feature("f1"), new Feature("f2")}; Assert.assertNotNull(FeatureJsonParser.featureArrayToJson(features)); Assert.assertNotNull(FeatureJsonParser.featureArrayToJson(null)); }
public static String featureArrayToJson(Feature[] features) { StringBuilder sb = new StringBuilder(); sb.append("["); if (features != null) { boolean first = true; for (Feature feature : features) { sb.append(first ? "" : ","); sb.append(feature.toJson()); first = false; } } sb.append("]"); return sb.toString(); }
FeatureJsonParser { public static String featureArrayToJson(Feature[] features) { StringBuilder sb = new StringBuilder(); sb.append("["); if (features != null) { boolean first = true; for (Feature feature : features) { sb.append(first ? "" : ","); sb.append(feature.toJson()); first = false; } } sb.append("]"); return sb.toString(); } }
FeatureJsonParser { public static String featureArrayToJson(Feature[] features) { StringBuilder sb = new StringBuilder(); sb.append("["); if (features != null) { boolean first = true; for (Feature feature : features) { sb.append(first ? "" : ","); sb.append(feature.toJson()); first = false; } } sb.append("]"); return sb.toString(); } private  FeatureJsonParser(); }
FeatureJsonParser { public static String featureArrayToJson(Feature[] features) { StringBuilder sb = new StringBuilder(); sb.append("["); if (features != null) { boolean first = true; for (Feature feature : features) { sb.append(first ? "" : ","); sb.append(feature.toJson()); first = false; } } sb.append("]"); return sb.toString(); } private  FeatureJsonParser(); @SuppressWarnings("unchecked") static Feature parseFeature(String json); @SuppressWarnings("unchecked") static Set<String> parsePermissions(String json); static String featureArrayToJson(Feature[] features); @SuppressWarnings("unchecked") static FlippingStrategy parseFlipStrategyAsJson(String uid, String json); @SuppressWarnings("unchecked") static FlippingStrategy parseFlipStrategy(String uid, Map<String, Object> flipMap); @SuppressWarnings("unchecked") static Feature[] parseFeatureArray(String json); }
FeatureJsonParser { public static String featureArrayToJson(Feature[] features) { StringBuilder sb = new StringBuilder(); sb.append("["); if (features != null) { boolean first = true; for (Feature feature : features) { sb.append(first ? "" : ","); sb.append(feature.toJson()); first = false; } } sb.append("]"); return sb.toString(); } private  FeatureJsonParser(); @SuppressWarnings("unchecked") static Feature parseFeature(String json); @SuppressWarnings("unchecked") static Set<String> parsePermissions(String json); static String featureArrayToJson(Feature[] features); @SuppressWarnings("unchecked") static FlippingStrategy parseFlipStrategyAsJson(String uid, String json); @SuppressWarnings("unchecked") static FlippingStrategy parseFlipStrategy(String uid, Map<String, Object> flipMap); @SuppressWarnings("unchecked") static Feature[] parseFeatureArray(String json);  }