@Test public void testStripMap() { Map<String, Object> body = new HashMap<String, Object>(); Map<String, Object> embeddedMap = new HashMap<String, Object>(); embeddedMap.put("ef1", "ev1"); embeddedMap.put("ef2", "ev2"); body.put("f1", embeddedMap); EntityManipulator.removeFields(body, "f1.ef1"); @SuppressWarnings("unchecked") Map<String, Object> f1 = (Map<String, Object>) body.get("f1"); assertTrue(f1 != null); assertEquals("ev2", f1.get("ef2")); assertTrue(f1.get("ef1") == null); }
public static void removeFields(final Map<String, Object> toRemoveFrom, final List<String> toRemoveList) { if (toRemoveList == null || toRemoveList.isEmpty()) { return; } if (toRemoveFrom == null) { return; } for (final String toStrip : toRemoveList) { removeField(toRemoveFrom, toStrip); } }
EntityManipulator { public static void removeFields(final Map<String, Object> toRemoveFrom, final List<String> toRemoveList) { if (toRemoveList == null || toRemoveList.isEmpty()) { return; } if (toRemoveFrom == null) { return; } for (final String toStrip : toRemoveList) { removeField(toRemoveFrom, toStrip); } } }
EntityManipulator { public static void removeFields(final Map<String, Object> toRemoveFrom, final List<String> toRemoveList) { if (toRemoveList == null || toRemoveList.isEmpty()) { return; } if (toRemoveFrom == null) { return; } for (final String toStrip : toRemoveList) { removeField(toRemoveFrom, toStrip); } } private  EntityManipulator(); }
EntityManipulator { public static void removeFields(final Map<String, Object> toRemoveFrom, final List<String> toRemoveList) { if (toRemoveList == null || toRemoveList.isEmpty()) { return; } if (toRemoveFrom == null) { return; } for (final String toStrip : toRemoveList) { removeField(toRemoveFrom, toStrip); } } private  EntityManipulator(); static void removeFields(final Map<String, Object> toRemoveFrom, final List<String> toRemoveList); static void removeFields(final Map<String, Object> toRemoveFrom, final String toRemove); }
EntityManipulator { public static void removeFields(final Map<String, Object> toRemoveFrom, final List<String> toRemoveList) { if (toRemoveList == null || toRemoveList.isEmpty()) { return; } if (toRemoveFrom == null) { return; } for (final String toStrip : toRemoveList) { removeField(toRemoveFrom, toStrip); } } private  EntityManipulator(); static void removeFields(final Map<String, Object> toRemoveFrom, final List<String> toRemoveList); static void removeFields(final Map<String, Object> toRemoveFrom, final String toRemove);  }