com.google.gson.JsonArray.addAll()方法的使用及代码示例

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

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

JsonArray.addAll介绍

[英]Adds all the elements of the specified array to self.
[中]将指定数组的所有元素添加到self。

代码示例

代码示例来源:origin: tomzo/gocd-yaml-config-plugin

public void append(JsonConfigCollection other) {
  this.environments.addAll(other.environments);
  this.pipelines.addAll(other.pipelines);
  this.errors.addAll(other.errors);
  this.uniqueVersions.addAll(other.uniqueVersions);
}

代码示例来源:origin: hibernate/hibernate-search

@Override
public void collectSort(JsonArray sorts) {
  if ( jsonSort == null ) {
    jsonSort = new JsonArray();
  }
  this.jsonSort.addAll( sorts );
}

代码示例来源:origin: org.hibernate.search/hibernate-search-backend-elasticsearch

@Override
public void collectSort(JsonArray sorts) {
  if ( jsonSort == null ) {
    jsonSort = new JsonArray();
  }
  this.jsonSort.addAll( sorts );
}

代码示例来源:origin: org.kurento/kurento-module-creator

private void addChildren(JsonElement fromElement, JsonElement toElement) {
 if (fromElement instanceof JsonObject && toElement instanceof JsonObject) {
  JsonObject fromObject = (JsonObject) fromElement;
  JsonObject toObject = (JsonObject) toElement;
  for (Entry<String, JsonElement> entry : fromObject.entrySet()) {
   toObject.add(entry.getKey(), entry.getValue());
  }
 } else if (fromElement instanceof JsonArray && toElement instanceof JsonArray) {
  JsonArray fromArray = (JsonArray) fromElement;
  JsonArray toArray = (JsonArray) toElement;
  toArray.addAll(fromArray);
 }
}

代码示例来源:origin: stackoverflow.com

JsonObject jRoot = RestManager.getJSONfromURL(myuri); // retrieve the entire json stream
JsonElement interventionElement = jRoot.get("intervention");
JsonArray interventionList = new JsonArray();

if(interventionElement.isJsonArray()) interventionList.addAll(interventionElement.getAsJsonArray());
else interventionList.add(interventionElement);

代码示例来源:origin: cheng-li/pyramid

field = writeRuleField;
thisClass.get("rules").getAsJsonArray().add(oneRule);
allPos.addAll(pos);

代码示例来源:origin: matrix-org/matrix-android-sdk

/**
 * Add ice candidates
 *
 * @param candidates ic candidates
 */
private void addCandidates(JsonArray candidates) {
  if (mIsIncomingPrepared || !isIncoming()) {
    onNewCandidates(candidates);
  } else {
    synchronized (LOG_TAG) {
      mPendingCandidates.addAll(candidates);
    }
  }
}

代码示例来源:origin: stackoverflow.com

JsonElement father = context.serialize(user.getFather());
if (father.isJsonArray()) {
  els.addAll(father.getAsJsonArray());
} else {
  els.add(father);

代码示例来源:origin: com.ibm.devops/ibm-cloud-devops

intermediateArray.addAll(issues);
recordCount = issues.size();
page += 1;

代码示例来源:origin: tropo/tropo-webapi-java

((JsonArray) oldKeyElement).addAll((JsonArray) json);
newArray.add(oldKeyElement);
if (json.isJsonArray()) {
  newArray.addAll((JsonArray) json);

代码示例来源:origin: cheng-li/pyramid

checkOneRule.add("threshold", check.get("threshold"));
checkOneRule.addProperty("highlights", pos.toString()); // converting 'pos' to string, like in visualizer.py
allPos.addAll(pos);
oneRule.get("checks").getAsJsonArray().add(checkOneRule);

代码示例来源:origin: ibm-watson-iot/iot-java

groups = innerGroups;
} else {
  groups.addAll(innerGroups);

代码示例来源:origin: matrix-org/matrix-android-sdk

+ " to " + (lastContentCandidates.size() + newContentCandidates.size() + " items."));
lastContentCandidates.addAll(newContentCandidates);

代码示例来源:origin: asukaonly/weibo-lottery

if (!o.has("title") || !o.get("title").getAsString().equals("热门微博")) {
  if (o.has("card_group")) {
    contents.addAll(o.get("card_group").getAsJsonArray());

代码示例来源:origin: Esteemed-Innovation/Esteemed-Innovation

/**
 * Converts a {@link BiomeDefinition} into a JsonObject, with keys "Dimension", "Biome", "MinY", "MaxY",
 * "MaxVeinSize", "MaxVeinsPerChunk", and "ReplaceableBlocks".
 */
private JsonObject writeBiomeToObject(BiomeDefinition biome) {
  JsonObject obj = new JsonObject();
  obj.addProperty("Dimension", biome.getDimension());
  Biome actualBiome = biome.getBiomeMatcher().getBiome();
  obj.addProperty("Biome", actualBiome == null ? "*" : actualBiome.getRegistryName().toString());
  obj.addProperty("MinY", biome.getMinY());
  obj.addProperty("MaxY", biome.getMaxY());
  obj.addProperty("MaxVeinSize", biome.getMaxVeinSize());
  obj.addProperty("MaxVeinsPerChunk", biome.getMaxVeinsPerChunk());
  JsonArray oreDicts = writeStringsToArray(biome.getReplaceableBlocksOreDict());
  JsonArray blocks = writeBlocksToArray(biome.getReplaceableBlocksAndMeta());
  blocks.addAll(oreDicts);
  obj.add("ReplaceableBlocks", blocks);
  return obj;
}

代码示例来源:origin: matrix-org/matrix-android-sdk

/**
 * Add ice candidates
 *
 * @param candidates ic candidates
 */
private void addCandidates(JsonArray candidates) {
  if (mIsIncomingPrepared || !isIncoming()) {
    Log.d(LOG_TAG, "addCandidates : ready");
    onNewCandidates(candidates);
  } else {
    synchronized (LOG_TAG) {
      Log.d(LOG_TAG, "addCandidates : pending");
      mPendingCandidates.addAll(candidates);
    }
  }
}

代码示例来源:origin: org.ballerinalang/language-server-core

.getAsString().equals("service")))) {
node.getAsJsonObject("variable").getAsJsonArray(FormattingConstants.WS)
    .addAll(node.getAsJsonArray(FormattingConstants.WS));
node.remove(FormattingConstants.WS);
allParamsTemp.addAll(node.getAsJsonArray("defaultableParameters"));
List<JsonElement> allParamElements = new ArrayList<>();
allParamsTemp.forEach(allParamElements::add);

代码示例来源:origin: Comcast/zucchini

AbstractZucchiniTest.featureSet.put(fileName, features);
else
  AbstractZucchiniTest.featureSet.get(fileName).addAll(features);

代码示例来源:origin: stackoverflow.com

RallyRestApi restApi = new RallyRestApi(new URI("https://rally.rallydev.com/"), "_apogjlfdkjglfjlksr23rfdlj");
 String wsapiVersion = "v2.0";
 String workspaceRef = "/workspace/01245";
 String projectRef = "/project/6757552";
 if(restApi!=null){
   restApi.setWsapiVersion(wsapiVersion);
   QueryRequest queryRequest = new QueryRequest("TestFolders");
   queryRequest.setFetch(new Fetch(new String[] { "Name","FormattedID","TestFolder"}));
   queryRequest.setWorkspace(workspaceRef);
   queryRequest.setProject(projectRef);
   queryRequest.setScopedDown(true);
   queryRequest.setLimit(Integer.MAX_VALUE);
   queryRequest.setPageSize(Integer.MAX_VALUE);
   QueryResponse queryResponse = null;
   JsonArray jsonarr = new JsonArray();
   queryResponse = restApi.query(queryRequest);
   int responseTotalResultsCount = queryResponse.getTotalResultCount();
   jsonarr.addAll(queryResponse.getResults());
   int jsonArrSize = jsonarr.size();
   for (int i=0; i<queryResponse.getResults().size();i++){
     JsonObject testCaseJsonObject = queryResponse.getResults().get(i).getAsJsonObject();
     System.out.println(testCaseJsonObject.getAsJsonObject().get("FormattedID")+": "+testCaseJsonObject.getAsJsonObject().get("Name"));
   }
 }

相关文章