com.eclipsesource.json.JsonObject.get()方法的使用及代码示例

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

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

JsonObject.get介绍

[英]Returns the value of the member with the specified name in this object. If this object contains multiple members with the given name, this method will return the last one.
[中]返回此对象中具有指定名称的成员的值。如果此对象包含多个具有给定名称的成员,则此方法将返回最后一个成员。

代码示例

代码示例来源:origin: libgdx/packr

if (json.get("platform") != null) {
  platform = Platform.byDesc(json.get("platform").asString());
if (json.get("jdk") != null) {
  jdk = json.get("jdk").asString();
if (json.get("executable") != null) {
  executable = json.get("executable").asString();
if (json.get("classpath") != null) {
  classpath = toStringArray(json.get("classpath").asArray());
if (json.get("removelibs") != null) {
  removePlatformLibs = toStringArray(json.get("removelibs").asArray());
if (json.get("mainclass") != null) {
  mainClass = json.get("mainclass").asString();
if (json.get("vmargs") != null) {
  List<String> vmArgs = toStringArray(json.get("vmargs").asArray());
  this.vmArgs = new ArrayList<>();
  for (String vmArg : vmArgs) {
if (json.get("minimizejre") != null) {
  minimizeJre = json.get("minimizejre").asString();
if (json.get("cachejre") != null) {
  cacheJre = new File(json.get("cachejre").asString());

代码示例来源:origin: Vedenin/useful-java-links

public static void main(String[] args) throws IOException {
    // convert Java to writer
    JsonObject root = Json.object().add("message", "Hi").add(
        "place", Json.object().add("name", "World!")
    );
    StringWriter writer = new StringWriter();
    root.writeTo(writer);
    String json = writer.toString();
    System.out.println(json);

    System.out.println();
    // convert writer to Java
    JsonObject obj = Json.parse(json).asObject();
    String message = obj.get("message").asString();
    String name = obj.get("place").asObject().get("name").asString();
    System.out.println(message + " " + name);
  }
}

代码示例来源:origin: libgdx/packr

JsonArray reduceArray = minimizeJson.get("reduce").asArray();
for (JsonValue reduce : reduceArray) {
  String path = reduce.asObject().get("archive").asString();
  File file = new File(output, path);
  JsonArray removeArray = reduce.asObject().get("paths").asArray();
  for (JsonValue remove : removeArray) {
    File removeFile = new File(fileNoExt, remove.asString());
    if (removeFile.exists()) {
      if (removeFile.isDirectory()) {
JsonArray removeArray = minimizeJson.get("remove").asArray();
for (JsonValue remove : removeArray) {
  String platform = remove.asObject().get("platform").asString();
  JsonArray removeFilesArray = remove.asObject().get("paths").asArray();
  for (JsonValue removeFile : removeFilesArray) {
    removeFileWildcard(output, removeFile.asString(), config);

代码示例来源:origin: ralfstx/minimal-json

/**
 * Returns the <code>String</code> value of the member with the specified name in this object. If
 * this object does not contain a member with this name, the given default value is returned. If
 * this object contains multiple members with the given name, the last one is picked. If this
 * member's value does not represent a JSON string, an exception is thrown.
 *
 * @param name
 *          the name of the member whose value is to be returned
 * @param defaultValue
 *          the value to be returned if the requested member is missing
 * @return the value of the last member with the specified name, or the given default value if
 *         this object does not contain a member with that name
 */
public String getString(String name, String defaultValue) {
 JsonValue value = get(name);
 return value != null ? value.asString() : defaultValue;
}

代码示例来源:origin: ralfstx/minimal-json

private static JsonValue extractSimpleName(JsonObject caliperResults) {
 String name = caliperResults.get("run").asObject().get("benchmarkName").asString();
 return Json.value(name.replaceFirst(".*\\.", ""));
}

代码示例来源:origin: box/box-java-sdk

/**
 * Create a filter for matching against a metadata field defined in JSON.
 * @param jsonObj the JSON object to construct the filter from.
 */
public MetadataFieldFilter(JsonObject jsonObj) {
  this.field = jsonObj.get("field").asString();
  JsonValue value = jsonObj.get("value");
  this.value = value;
}

代码示例来源:origin: dvdme/forecastio-lib-java

/**
 * Returns the timezone that is setted.
 * @return A String with the timezone.
 */
public String getTimezone(){
  return this.forecast.get("timezone").asString();
}

代码示例来源:origin: box/box-java-sdk

@Override
  public boolean shouldInclude(JsonObject jsonObject) {
    String type = jsonObject.get("type").asString();
    return (type.equals("file") || type.equals("folder") || type.equals("web_link"));
  }
});

代码示例来源:origin: box/box-java-sdk

BoxFileVersion(BoxAPIConnection api, JsonObject jsonObject, String fileID) {
  super(api, jsonObject.get("id").asString());
  this.fileID = fileID;
  this.parseJSON(jsonObject);
}

代码示例来源:origin: box/box-java-sdk

EventLog(BoxAPIConnection api, JsonObject json, String streamPosition, int limit) {
  this.streamPosition = streamPosition;
  this.limit = limit;
  this.nextStreamPosition = json.get("next_stream_position").asString();
  this.chunkSize = json.get("chunk_size").asInt();
  this.set = new LinkedHashSet<BoxEvent>(this.chunkSize);
  JsonArray entries = json.get("entries").asArray();
  for (JsonValue entry : entries) {
    this.set.add(new BoxEvent(api, entry.asObject()));
  }
}

代码示例来源:origin: samczsun/Skype4J

@Override
  public void handle(SkypeImpl skype, JsonObject resource) throws ConnectionException, ChatNotFoundException, IOException {
    String from = resource.get("from").asString();
    String url = resource.get("conversationLink").asString();
    String content = resource.get("content").asString();
    boolean finished = content.startsWith("<ended/>") || content.startsWith("<partlist type=\"ended\"");
    ChatImpl c = getChat(url, skype);
    Participant u = getUser(from, c);
    CallReceivedEvent event = new CallReceivedEvent(c, u, !finished);
    skype.getEventDispatcher().callEvent(event);
  }
},

代码示例来源:origin: box/box-java-sdk

private void updateAccessibleBy(JsonObject json) {
  String type = json.get("type").asString();
  if ((type.equals("user") && this.accessibleBy instanceof BoxUser.Info)
      || (type.equals("group") && this.accessibleBy instanceof BoxGroup.Info)) {
    this.accessibleBy.update(json);
  } else {
    this.accessibleBy = this.parseAccessibleBy(json);
  }
}

代码示例来源:origin: box/box-java-sdk

private List<BoxFolder.Info> parsePathCollection(JsonObject jsonObject) {
  int count = jsonObject.get("total_count").asInt();
  List<BoxFolder.Info> pathCollection = new ArrayList<BoxFolder.Info>(count);
  JsonArray entries = jsonObject.get("entries").asArray();
  for (JsonValue value : entries) {
    JsonObject entry = value.asObject();
    String id = entry.get("id").asString();
    BoxFolder folder = new BoxFolder(getAPI(), id);
    pathCollection.add(folder.new Info(entry));
  }
  return pathCollection;
}

代码示例来源:origin: box/box-java-sdk

@Override
  protected BoxMetadataCascadePolicy.Info factory(JsonObject jsonObject) {
    BoxMetadataCascadePolicy cascadePolicy =
        new BoxMetadataCascadePolicy(api, jsonObject.get("id").asString());
    return cascadePolicy.new Info(jsonObject);
  }
};

代码示例来源:origin: box/box-java-sdk

@Override
  protected BoxCollaborationWhitelist.Info factory(JsonObject jsonObject) {
    BoxCollaborationWhitelist whitelist = new BoxCollaborationWhitelist(
        api, jsonObject.get("id").asString());
    return whitelist.new Info(jsonObject);
  }
};

代码示例来源:origin: box/box-java-sdk

@Override
  protected BoxFileVersionRetention.Info factory(JsonObject jsonObject) {
    BoxFileVersionRetention retention = new BoxFileVersionRetention(api, jsonObject.get("id").asString());
    return retention.new Info(jsonObject);
  }
};

代码示例来源:origin: box/box-java-sdk

@Override
protected BoxWebHook.Info factory(JsonObject jsonObject) {
  BoxWebHook webHook = new BoxWebHook(api, jsonObject.get("id").asString());
  return webHook.new Info(jsonObject);
}

代码示例来源:origin: box/box-java-sdk

@Override
  protected BoxCollaborationWhitelistExemptTarget.Info factory(JsonObject jsonObject) {
    BoxCollaborationWhitelistExemptTarget userWhitelist = new BoxCollaborationWhitelistExemptTarget(
        api, jsonObject.get("id").asString());
    return userWhitelist.new Info(jsonObject);
  }
};

代码示例来源:origin: kiegroup/droolsjbpm-tools

private IKieSpaceHandler newKieSpaceHandler(final IKieServerHandler server, final JsonObject spaceJson) {
  final KieSpaceHandler space = new KieSpaceHandler(server, spaceJson.get("name").asString());
  space.setProperties(spaceJson);
  return space;
}

代码示例来源:origin: box/box-java-sdk

@Override
  protected BoxDevicePin.Info factory(JsonObject jsonObject) {
    BoxDevicePin pin = new BoxDevicePin(api, jsonObject.get("id").asString());
    return pin.new Info(jsonObject);
  }
};

相关文章