com.jayway.jsonpath.JsonPath.resultByConfiguration()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(14.1k)|赞(0)|评价(0)|浏览(120)

本文整理了Java中com.jayway.jsonpath.JsonPath.resultByConfiguration()方法的一些代码示例,展示了JsonPath.resultByConfiguration()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JsonPath.resultByConfiguration()方法的具体详情如下:
包路径:com.jayway.jsonpath.JsonPath
类名称:JsonPath
方法名:resultByConfiguration

JsonPath.resultByConfiguration介绍

暂无

代码示例

代码示例来源:origin: json-path/JsonPath

/**
 * 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);
}

代码示例来源:origin: json-path/JsonPath

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);
}

代码示例来源:origin: json-path/JsonPath

/**
 * 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);
}

代码示例来源:origin: json-path/JsonPath

/**
 * 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);
}

代码示例来源:origin: json-path/JsonPath

/**
 * 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);
}

代码示例来源:origin: json-path/JsonPath

/**
 * 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);
}

代码示例来源:origin: com.jayway.jsonpath/json-path

/**
 * 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);
}

代码示例来源:origin: com.jayway.jsonpath/json-path

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);
}

代码示例来源:origin: com.jayway.jsonpath/json-path

/**
 * 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);
}

代码示例来源:origin: com.jayway.jsonpath/json-path

/**
 * 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);
}

代码示例来源:origin: com.jayway.jsonpath/json-path

/**
 * 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);
}

代码示例来源:origin: com.jayway.jsonpath/json-path

/**
 * 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);
}

代码示例来源:origin: com.github.lafa.jsonpath/json-path

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);
}

代码示例来源:origin: com.github.lafa.jsonpath/json-path

/**
 * 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);
}

代码示例来源:origin: com.github.lafa.jsonpath/json-path

/**
 * 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);
}

代码示例来源:origin: com.github.lafa.jsonpath/json-path

/**
 * 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);
}

代码示例来源:origin: com.github.lafa.jsonpath/json-path

/**
 * 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);
}

代码示例来源:origin: com.github.lafa.jsonpath/json-path

/**
 * 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);
}

相关文章