@Test public void testParseFlipStrategyAsJson() { Assert.assertNull(FeatureJsonParser.parseFlipStrategyAsJson("f1", "")); Assert.assertNull(FeatureJsonParser.parseFlipStrategyAsJson("f1", null)); String fExp = "{\"initParams\":{\"weight\":\"0.6\"},\"type\":\"org.ff4j.strategy.PonderationStrategy\"}"; Assert.assertNotNull(FeatureJsonParser.parseFlipStrategyAsJson("f1", fExp)); }
@SuppressWarnings("unchecked") public static FlippingStrategy parseFlipStrategyAsJson(String uid, String json) { if (null == json || "".equals(json)) { return null; } try { return parseFlipStrategy(uid, (HashMap<String, Object>) objectMapper.readValue(json, HashMap.class)); } catch (Exception e) { throw new IllegalArgumentException("Cannot parse JSON " + json, e); } }
FeatureJsonParser { @SuppressWarnings("unchecked") public static FlippingStrategy parseFlipStrategyAsJson(String uid, String json) { if (null == json || "".equals(json)) { return null; } try { return parseFlipStrategy(uid, (HashMap<String, Object>) objectMapper.readValue(json, HashMap.class)); } catch (Exception e) { throw new IllegalArgumentException("Cannot parse JSON " + json, e); } } }
FeatureJsonParser { @SuppressWarnings("unchecked") public static FlippingStrategy parseFlipStrategyAsJson(String uid, String json) { if (null == json || "".equals(json)) { return null; } try { return parseFlipStrategy(uid, (HashMap<String, Object>) objectMapper.readValue(json, HashMap.class)); } catch (Exception e) { throw new IllegalArgumentException("Cannot parse JSON " + json, e); } } private  FeatureJsonParser(); }
FeatureJsonParser { @SuppressWarnings("unchecked") public static FlippingStrategy parseFlipStrategyAsJson(String uid, String json) { if (null == json || "".equals(json)) { return null; } try { return parseFlipStrategy(uid, (HashMap<String, Object>) objectMapper.readValue(json, HashMap.class)); } catch (Exception e) { throw new IllegalArgumentException("Cannot parse JSON " + json, e); } } 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 { @SuppressWarnings("unchecked") public static FlippingStrategy parseFlipStrategyAsJson(String uid, String json) { if (null == json || "".equals(json)) { return null; } try { return parseFlipStrategy(uid, (HashMap<String, Object>) objectMapper.readValue(json, HashMap.class)); } catch (Exception e) { throw new IllegalArgumentException("Cannot parse JSON " + json, e); } } 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);  }