org.codehaus.jettison.json.JSONObject.accumulate()方法的使用及代码示例

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

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

JSONObject.accumulate介绍

[英]Accumulate values under a key. It is similar to the put method except that if there is already an object stored under the key then a JSONArray is stored under the key to hold all of the accumulated values. If there is already a JSONArray, then the new value is appended to it. In contrast, the put method replaces the previous value.
[中]在键下累积值。它与put方法类似,只是如果已经有一个对象存储在该键下,那么会在该键下存储一个JSONArray来保存所有累积值。如果已经有一个JSONArray,那么新值将附加到它。相反,put方法将替换以前的值。

代码示例

代码示例来源:origin: com.couchbase.client/couchbase-client

jsonDesign.accumulate("language", language);
 jsonView.accumulate("map", view.getMap());
 if(!view.getReduce().isEmpty()) {
  jsonView.accumulate("reduce", view.getReduce());
 jsonViews.accumulate(view.getName(), jsonView);
jsonDesign.accumulate("views", jsonViews);
  jsonSpatialViews.accumulate(spatialView.getName(),
   spatialView.getMap());
 jsonDesign.accumulate("spatial", jsonSpatialViews);

代码示例来源:origin: ModeShape/modeshape

@Override
  public JSONObject toJSON() throws JSONException {
    JSONObject content = new JSONObject();
    content.put("mixin", isMixin);
    content.put("abstract", isAbstract);
    content.put("queryable", isQueryable);
    content.put("hasOrderableChildNodes", hasOrderableChildNodes);

    if (!propertyTypes.isEmpty()) {
      for (RestPropertyType restPropertyType : propertyTypes) {
        content.accumulate("propertyDefinitions", restPropertyType.toJSON());
      }
    }

    if (!superTypesLinks.isEmpty()) {
      content.put("superTypes", superTypesLinks);
    }

    if (!subTypesLinks.isEmpty()) {
      content.put("subTypes", subTypesLinks);
    }

    JSONObject result = new JSONObject();
    result.put(name, content);
    return result;
  }
}

代码示例来源:origin: inchaincodes/inchain

for(int j=0; j<codeList.length();j++) {
  JSONObject rs = rpcService.bindAntifake(codeList.get(j).toString(), productHash, trpw, address);
  results.accumulate(codeList.get(j).toString(),rs);

相关文章