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

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

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

JsonObject.isEmpty介绍

[英]Returns true if this object contains no members.
[中]如果此对象不包含成员,则返回true

代码示例

代码示例来源:origin: UniversaBlockchain/universa

public Answer commonRequest(String path, JsonObject params) throws IOException {
  synchronized (this) {
    String charset = "UTF-8";
    URLConnection connection = new URL(url + "/" + path).openConnection();
    connection.setConnectTimeout(CONNECTION_TIMEOUT);
    connection.setReadTimeout(CONNECTION_READ_TIMEOUT);
    connection.setRequestProperty("User-Agent", "Universa JAVA API Client");
    if(!params.isEmpty()) {
      connection.setRequestProperty("Content-Type", "application/json");
      connection.setDoOutput(true);
      try (
          OutputStream output = connection.getOutputStream();
          PrintWriter writer = new PrintWriter(new OutputStreamWriter(output, charset), true);
      ) {
        String json = params.toString();
        writer.append(json);
      }
    }
    HttpURLConnection httpConnection = (HttpURLConnection) connection;
    int responseCode = httpConnection.getResponseCode();
    byte[] answer = Do.read(httpConnection.getInputStream());
    httpConnection.disconnect();
    JsonValue json = Json.parse(new String(answer));
    return new Answer(responseCode, Binder.of("response",ofJson(json)));
  }
}

代码示例来源:origin: ZencashOfficial/zencash-swing-wallet-ui

if ((message == null) || (message.isEmpty()))

代码示例来源:origin: BTCPrivate/bitcoin-private-full-node-wallet

if ((message == null) || (message.isEmpty()))

相关文章