@SuppressWarnings("unchecked") public static void removeSubresources(JSONObject resourceJson, Class<? extends Resource> typeToBeRemoved, boolean recursive) { removeSubresources(resourceJson, new Class[]{typeToBeRemoved}, null, recursive); }
public static String removeSubresources(String resourceJson, Class<? extends Resource>[] typesToBeRemoved, String[] relativePaths, boolean recursive) throws JSONException { JSONObject obj = new JSONObject(resourceJson); removeSubresources(obj, typesToBeRemoved, relativePaths, recursive); return obj.toString(4); }
/** * Remove subresources of a specific type from a json representation of a resource. * * @param resourceJson * a serialized resource in json format * @param typeToBeRemoved * resources of this type will be removed from json * @param recursive * parse the resource tree recursively, to look for elements of type <code>typeToBeRemoved</code> * @throws JSONException * if input is not a valid json string */ public static String removeSubresources(String resourceJson, Class<? extends Resource> typeToBeRemoved, boolean recursive) throws JSONException { JSONObject obj = new JSONObject(resourceJson); removeSubresources(obj, typeToBeRemoved, recursive); return obj.toString(4); }
continue; if (recursive) { removeSubresources(subsub, typesToBeRemoved, subresourceNames, recursive);
json = SerializationUtils.removeSubresources(json, RestConnection.class, false);
json = SerializationUtils.removeSubresources(json, new Class[]{RestConnection.class}, subresources, false);