/** * Set the value this path points to in the provided jsonObject * * @param jsonObject a json object * @param configuration configuration to use * @param <T> expected return type * @return the updated jsonObject or the path list to updated objects if option AS_PATH_LIST is set. */ public <T> T set(Object jsonObject, Object newVal, Configuration configuration) { notNull(jsonObject, "json can not be null"); notNull(configuration, "configuration can not be null"); EvaluationContext evaluationContext = path.evaluate(jsonObject, jsonObject, configuration, true); for (PathRef updateOperation : evaluationContext.updateOperations()) { updateOperation.set(newVal, configuration); } return resultByConfiguration(jsonObject, configuration, evaluationContext); }
public <T> T renameKey(Object jsonObject, String oldKeyName, String newKeyName, Configuration configuration) { notNull(jsonObject, "json can not be null"); notEmpty(newKeyName, "newKeyName can not be null or empty"); notNull(configuration, "configuration can not be null"); EvaluationContext evaluationContext = path.evaluate(jsonObject, jsonObject, configuration, true); for (PathRef updateOperation : evaluationContext.updateOperations()) { updateOperation.renameKey(oldKeyName, newKeyName, configuration); } return resultByConfiguration(jsonObject, configuration, evaluationContext); }
/** * Deletes the object this path points to in the provided jsonObject * * @param jsonObject a json object * @param configuration configuration to use * @param <T> expected return type * @return the updated jsonObject or the path list to deleted objects if option AS_PATH_LIST is set. */ public <T> T delete(Object jsonObject, Configuration configuration) { notNull(jsonObject, "json can not be null"); notNull(configuration, "configuration can not be null"); EvaluationContext evaluationContext = path.evaluate(jsonObject, jsonObject, configuration, true); for (PathRef updateOperation : evaluationContext.updateOperations()) { updateOperation.delete(configuration); } return resultByConfiguration(jsonObject, configuration, evaluationContext); }
/** * Adds a new value to the Array this path points to in the provided jsonObject * * @param jsonObject a json object * @param value the value to add * @param configuration configuration to use * @param <T> expected return type * @return the updated jsonObject or the path list to updated object if option AS_PATH_LIST is set. */ public <T> T add(Object jsonObject, Object value, Configuration configuration) { notNull(jsonObject, "json can not be null"); notNull(configuration, "configuration can not be null"); EvaluationContext evaluationContext = path.evaluate(jsonObject, jsonObject, configuration, true); for (PathRef updateOperation : evaluationContext.updateOperations()) { updateOperation.add(value, configuration); } return resultByConfiguration(jsonObject, configuration, evaluationContext); }
/** * Replaces the value on the given path with the result of the {@link MapFunction}. * * @param jsonObject a json object * @param mapFunction Converter object to be invoked * @param configuration configuration to use * @return the updated jsonObject or the path list to updated objects if option AS_PATH_LIST is set. */ public <T> T map(Object jsonObject, MapFunction mapFunction, Configuration configuration) { notNull(jsonObject, "json can not be null"); notNull(configuration, "configuration can not be null"); notNull(mapFunction, "mapFunction can not be null"); EvaluationContext evaluationContext = path.evaluate(jsonObject, jsonObject, configuration, true); for (PathRef updateOperation : evaluationContext.updateOperations()) { updateOperation.convert(mapFunction, configuration); } return resultByConfiguration(jsonObject, configuration, evaluationContext); }
/** * Adds or updates the Object this path points to in the provided jsonObject with a key with a value * * @param jsonObject a json object * @param value the key to add or update * @param value the new value * @param configuration configuration to use * @param <T> expected return type * @return the updated jsonObject or the path list to updated objects if option AS_PATH_LIST is set. */ public <T> T put(Object jsonObject, String key, Object value, Configuration configuration) { notNull(jsonObject, "json can not be null"); notEmpty(key, "key can not be null or empty"); notNull(configuration, "configuration can not be null"); EvaluationContext evaluationContext = path.evaluate(jsonObject, jsonObject, configuration, true); for (PathRef updateOperation : evaluationContext.updateOperations()) { updateOperation.put(key, value, configuration); } return resultByConfiguration(jsonObject, configuration, evaluationContext); }
/** * Set the value this path points to in the provided jsonObject * * @param jsonObject a json object * @param configuration configuration to use * @param <T> expected return type * @return the updated jsonObject or the path list to updated objects if option AS_PATH_LIST is set. */ public <T> T set(Object jsonObject, Object newVal, Configuration configuration) { notNull(jsonObject, "json can not be null"); notNull(configuration, "configuration can not be null"); EvaluationContext evaluationContext = path.evaluate(jsonObject, jsonObject, configuration, true); for (PathRef updateOperation : evaluationContext.updateOperations()) { updateOperation.set(newVal, configuration); } return resultByConfiguration(jsonObject, configuration, evaluationContext); }
public <T> T renameKey(Object jsonObject, String oldKeyName, String newKeyName, Configuration configuration) { notNull(jsonObject, "json can not be null"); notEmpty(newKeyName, "newKeyName can not be null or empty"); notNull(configuration, "configuration can not be null"); EvaluationContext evaluationContext = path.evaluate(jsonObject, jsonObject, configuration, true); for (PathRef updateOperation : evaluationContext.updateOperations()) { updateOperation.renameKey(oldKeyName, newKeyName, configuration); } return resultByConfiguration(jsonObject, configuration, evaluationContext); }
/** * Deletes the object this path points to in the provided jsonObject * * @param jsonObject a json object * @param configuration configuration to use * @param <T> expected return type * @return the updated jsonObject or the path list to deleted objects if option AS_PATH_LIST is set. */ public <T> T delete(Object jsonObject, Configuration configuration) { notNull(jsonObject, "json can not be null"); notNull(configuration, "configuration can not be null"); EvaluationContext evaluationContext = path.evaluate(jsonObject, jsonObject, configuration, true); for (PathRef updateOperation : evaluationContext.updateOperations()) { updateOperation.delete(configuration); } return resultByConfiguration(jsonObject, configuration, evaluationContext); }
/** * Adds a new value to the Array this path points to in the provided jsonObject * * @param jsonObject a json object * @param value the value to add * @param configuration configuration to use * @param <T> expected return type * @return the updated jsonObject or the path list to updated object if option AS_PATH_LIST is set. */ public <T> T add(Object jsonObject, Object value, Configuration configuration) { notNull(jsonObject, "json can not be null"); notNull(configuration, "configuration can not be null"); EvaluationContext evaluationContext = path.evaluate(jsonObject, jsonObject, configuration, true); for (PathRef updateOperation : evaluationContext.updateOperations()) { updateOperation.add(value, configuration); } return resultByConfiguration(jsonObject, configuration, evaluationContext); }
/** * Replaces the value on the given path with the result of the {@link MapFunction}. * * @param jsonObject a json object * @param mapFunction Converter object to be invoked * @param configuration configuration to use * @return the updated jsonObject or the path list to updated objects if option AS_PATH_LIST is set. */ public <T> T map(Object jsonObject, MapFunction mapFunction, Configuration configuration) { notNull(jsonObject, "json can not be null"); notNull(configuration, "configuration can not be null"); notNull(mapFunction, "mapFunction can not be null"); EvaluationContext evaluationContext = path.evaluate(jsonObject, jsonObject, configuration, true); for (PathRef updateOperation : evaluationContext.updateOperations()) { updateOperation.convert(mapFunction, configuration); } return resultByConfiguration(jsonObject, configuration, evaluationContext); }
/** * Adds or updates the Object this path points to in the provided jsonObject with a key with a value * * @param jsonObject a json object * @param value the key to add or update * @param value the new value * @param configuration configuration to use * @param <T> expected return type * @return the updated jsonObject or the path list to updated objects if option AS_PATH_LIST is set. */ public <T> T put(Object jsonObject, String key, Object value, Configuration configuration) { notNull(jsonObject, "json can not be null"); notEmpty(key, "key can not be null or empty"); notNull(configuration, "configuration can not be null"); EvaluationContext evaluationContext = path.evaluate(jsonObject, jsonObject, configuration, true); for (PathRef updateOperation : evaluationContext.updateOperations()) { updateOperation.put(key, value, configuration); } return resultByConfiguration(jsonObject, configuration, evaluationContext); }
public <T> T renameKey(Object jsonObject, String oldKeyName, String newKeyName, Configuration configuration) { notNull(jsonObject, "json can not be null"); notEmpty(newKeyName, "newKeyName can not be null or empty"); notNull(configuration, "configuration can not be null"); EvaluationContext evaluationContext = path.evaluate(jsonObject, jsonObject, configuration, true); for (PathRef updateOperation : evaluationContext.updateOperations()) { updateOperation.renameKey(oldKeyName, newKeyName, configuration); } return resultByConfiguration(jsonObject, configuration, evaluationContext); }
/** * Deletes the object this path points to in the provided jsonObject * * @param jsonObject a json object * @param configuration configuration to use * @param <T> expected return type * @return the updated jsonObject or the path list to deleted objects if option AS_PATH_LIST is set. */ public <T> T delete(Object jsonObject, Configuration configuration) { notNull(jsonObject, "json can not be null"); notNull(configuration, "configuration can not be null"); EvaluationContext evaluationContext = path.evaluate(jsonObject, jsonObject, configuration, true); for (PathRef updateOperation : evaluationContext.updateOperations()) { updateOperation.delete(configuration); } return resultByConfiguration(jsonObject, configuration, evaluationContext); }
/** * Set the value this path points to in the provided jsonObject * * @param jsonObject a json object * @param configuration configuration to use * @param <T> expected return type * @return the updated jsonObject or the path list to updated objects if option AS_PATH_LIST is set. */ public <T> T set(Object jsonObject, Object newVal, Configuration configuration) { notNull(jsonObject, "json can not be null"); notNull(configuration, "configuration can not be null"); EvaluationContext evaluationContext = path.evaluate(jsonObject, jsonObject, configuration, true); for (PathRef updateOperation : evaluationContext.updateOperations()) { updateOperation.set(newVal, configuration); } return resultByConfiguration(jsonObject, configuration, evaluationContext); }
/** * Adds a new value to the Array this path points to in the provided jsonObject * * @param jsonObject a json object * @param value the value to add * @param configuration configuration to use * @param <T> expected return type * @return the updated jsonObject or the path list to updated object if option AS_PATH_LIST is set. */ public <T> T add(Object jsonObject, Object value, Configuration configuration) { notNull(jsonObject, "json can not be null"); notNull(configuration, "configuration can not be null"); EvaluationContext evaluationContext = path.evaluate(jsonObject, jsonObject, configuration, true); for (PathRef updateOperation : evaluationContext.updateOperations()) { updateOperation.add(value, configuration); } return resultByConfiguration(jsonObject, configuration, evaluationContext); }
/** * Replaces the value on the given path with the result of the {@link MapFunction}. * * @param jsonObject a json object * @param mapFunction Converter object to be invoked * @param configuration configuration to use * @return the updated jsonObject or the path list to updated objects if option AS_PATH_LIST is set. */ public <T> T map(Object jsonObject, MapFunction mapFunction, Configuration configuration) { notNull(jsonObject, "json can not be null"); notNull(configuration, "configuration can not be null"); notNull(mapFunction, "mapFunction can not be null"); EvaluationContext evaluationContext = path.evaluate(jsonObject, jsonObject, configuration, true); for (PathRef updateOperation : evaluationContext.updateOperations()) { updateOperation.convert(mapFunction, configuration); } return resultByConfiguration(jsonObject, configuration, evaluationContext); }
/** * Adds or updates the Object this path points to in the provided jsonObject with a key with a value * * @param jsonObject a json object * @param value the key to add or update * @param value the new value * @param configuration configuration to use * @param <T> expected return type * @return the updated jsonObject or the path list to updated objects if option AS_PATH_LIST is set. */ public <T> T put(Object jsonObject, String key, Object value, Configuration configuration) { notNull(jsonObject, "json can not be null"); notEmpty(key, "key can not be null or empty"); notNull(configuration, "configuration can not be null"); EvaluationContext evaluationContext = path.evaluate(jsonObject, jsonObject, configuration, true); for (PathRef updateOperation : evaluationContext.updateOperations()) { updateOperation.put(key, value, configuration); } return resultByConfiguration(jsonObject, configuration, evaluationContext); }