com.jayway.jsonpath.spi.json.JsonProvider.setProperty()方法的使用及代码示例

x33g5p2x  于2022-01-22 转载在 其他  
字(6.9k)|赞(0)|评价(0)|浏览(202)

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

JsonProvider.setProperty介绍

[英]Sets a value in an object
[中]设置对象中的值

代码示例

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

public void set(Object newVal, Configuration configuration){
  for (String property : properties) {
    configuration.jsonProvider().setProperty(parent, property, newVal);
  }
}
public void convert(MapFunction mapFunction, Configuration configuration) {

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

public void set(Object newVal, Configuration configuration){
  configuration.jsonProvider().setProperty(parent, property, newVal);
}

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

@Override
public void put(String key, Object newVal, Configuration configuration) {
  if(configuration.jsonProvider().isMap(parent)){
    configuration.jsonProvider().setProperty(parent, key, newVal);
  } else {
    throw new InvalidModificationException("Invalid put operation. $ is not a map");
  }
}

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

public void convert(MapFunction mapFunction, Configuration configuration) {
  for (String property : properties) {
    Object currentValue = configuration.jsonProvider().getMapValue(parent, property);
    if (currentValue != JsonProvider.UNDEFINED) {
      configuration.jsonProvider().setProperty(parent, property, mapFunction.map(currentValue, configuration));
    }
  }
}

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

@Override
public void convert(MapFunction mapFunction, Configuration configuration) {
  Object currentValue = configuration.jsonProvider().getMapValue(parent, property);
  configuration.jsonProvider().setProperty(parent, property, mapFunction.map(currentValue, configuration));
}

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

public void put(String key, Object value, Configuration configuration){
  Object target = configuration.jsonProvider().getArrayIndex(parent, index);
  if(targetInvalid(target)){
    return;
  }
  if(configuration.jsonProvider().isMap(target)){
    configuration.jsonProvider().setProperty(target, key, value);
  } else {
    throw new InvalidModificationException("Can only add properties to a map");
  }
}

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

public void put(String key, Object value, Configuration configuration){
  Object target = configuration.jsonProvider().getMapValue(parent, property);
  if(targetInvalid(target)){
    return;
  }
  if(configuration.jsonProvider().isMap(target)){
    configuration.jsonProvider().setProperty(target, key, value);
  } else {
    throw new InvalidModificationException("Can only add properties to a map");
  }
}

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

public void add(Object value, Configuration configuration){
  Object target = configuration.jsonProvider().getArrayIndex(parent, index);
  if(targetInvalid(target)){
    return;
  }
  if(configuration.jsonProvider().isArray(target)){
    configuration.jsonProvider().setProperty(target, null, value);
  } else {
    throw new InvalidModificationException("Can only add to an array");
  }
}

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

protected void renameInMap(Object targetMap, String oldKeyName, String newKeyName, Configuration configuration){
  if(configuration.jsonProvider().isMap(targetMap)){
    if(configuration.jsonProvider().getMapValue(targetMap, oldKeyName) == JsonProvider.UNDEFINED){
      throw new PathNotFoundException("No results for Key "+oldKeyName+" found in map!");
    }
    configuration.jsonProvider().setProperty(targetMap, newKeyName, configuration.jsonProvider().getMapValue(targetMap, oldKeyName));
    configuration.jsonProvider().removeProperty(targetMap, oldKeyName);
  } else {
    throw new InvalidModificationException("Can only rename properties in a map");
  }
}

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

ctx.jsonProvider().setProperty(merged, property, propertyVal);

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

public void set(Object newVal, Configuration configuration){
  for (String property : properties) {
    configuration.jsonProvider().setProperty(parent, property, newVal);
  }
}
public void convert(MapFunction mapFunction, Configuration configuration) {

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

public void set(Object newVal, Configuration configuration){
  configuration.jsonProvider().setProperty(parent, property, newVal);
}

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

@Override
public void put(String key, Object newVal, Configuration configuration) {
  if(configuration.jsonProvider().isMap(parent)){
    configuration.jsonProvider().setProperty(parent, key, newVal);
  } else {
    throw new InvalidModificationException("Invalid put operation. $ is not a map");
  }
}

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

@Override
public void convert(MapFunction mapFunction, Configuration configuration) {
  Object currentValue = configuration.jsonProvider().getMapValue(parent, property);
  configuration.jsonProvider().setProperty(parent, property, mapFunction.map(currentValue, configuration));
}

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

public void convert(MapFunction mapFunction, Configuration configuration) {
  for (String property : properties) {
    Object currentValue = configuration.jsonProvider().getMapValue(parent, property);
    configuration.jsonProvider().setProperty(parent, property, mapFunction.map(currentValue, configuration));
  }
}

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

public void add(Object value, Configuration configuration){
  Object target = configuration.jsonProvider().getArrayIndex(parent, index);
  if(targetInvalid(target)){
    return;
  }
  if(configuration.jsonProvider().isArray(target)){
    configuration.jsonProvider().setProperty(target, null, value);
  } else {
    throw new InvalidModificationException("Can only add to an array");
  }
}

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

public void put(String key, Object value, Configuration configuration){
  Object target = configuration.jsonProvider().getArrayIndex(parent, index);
  if(targetInvalid(target)){
    return;
  }
  if(configuration.jsonProvider().isMap(target)){
    configuration.jsonProvider().setProperty(target, key, value);
  } else {
    throw new InvalidModificationException("Can only add properties to a map");
  }
}

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

public void put(String key, Object value, Configuration configuration){
  Object target = configuration.jsonProvider().getMapValue(parent, property);
  if(targetInvalid(target)){
    return;
  }
  if(configuration.jsonProvider().isMap(target)){
    configuration.jsonProvider().setProperty(target, key, value);
  } else {
    throw new InvalidModificationException("Can only add properties to a map");
  }
}

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

protected void renameInMap(Object targetMap, String oldKeyName, String newKeyName, Configuration configuration){
  if(configuration.jsonProvider().isMap(targetMap)){
    if(configuration.jsonProvider().getMapValue(targetMap, oldKeyName) == JsonProvider.UNDEFINED){
      throw new PathNotFoundException("No results for Key "+oldKeyName+" found in map!");
    }
    configuration.jsonProvider().setProperty(targetMap, newKeyName, configuration.jsonProvider().getMapValue(targetMap, oldKeyName));
    configuration.jsonProvider().removeProperty(targetMap, oldKeyName);
  } else {
    throw new InvalidModificationException("Can only rename properties in a map");
  }
}

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

ctx.jsonProvider().setProperty(merged, property, propertyVal);

相关文章