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

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

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

JsonObject.getBoolean介绍

[英]Returns the boolean 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 will be picked. If this member's value does not represent a JSON true or false value, an exception is thrown.
[中]返回此对象中具有指定名称的成员的boolean值。如果此对象不包含具有此名称的成员,则返回给定的默认值。如果此对象包含多个具有给定名称的成员,则将拾取最后一个成员。如果此成员的值不表示JSONtruefalse值,则会引发异常。

代码示例

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

public synchronized boolean isWatchOnlyOrInvalidAddress(String address)
  throws WalletCallException, IOException, InterruptedException
{
  JsonObject response = this.executeCommandAndGetJsonValue("validateaddress", wrapStringParameter(address)).asObject();
  if (response.getBoolean("isvalid", false))
  {
    return response.getBoolean("iswatchonly", true);
  }
  
  return true;
}

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

public synchronized boolean isWatchOnlyOrInvalidAddress(String address)
    throws WalletCallException, IOException, InterruptedException {
  JsonObject response = this.executeCommandAndGetJsonValue("validateaddress", wrapStringParameter(address)).asObject();
  if (response.getBoolean("isvalid", false)) {
    return response.getBoolean("iswatchonly", true);
  }
  return true;
}

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

public void copyFromJSONObject(JsonObject obj)
    throws IOException
{
  // Mandatory fields!
  this.automaticallyAddUsersIfNotExplicitlyImported =
      obj.getBoolean("automaticallyaddusersifnotexplicitlyimported", true);
  this.amountToSend   = obj.getDouble("amounttosend",   0.0001d);
  this.transactionFee = obj.getDouble("transactionfee", 0.0001d);
}

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

public void copyFromJSONObject(JsonObject obj)
  throws IOException
{
  // Mandatory fields!
  this.automaticallyAddUsersIfNotExplicitlyImported = 
    obj.getBoolean("automaticallyaddusersifnotexplicitlyimported", true);
  this.amountToSend   = obj.getDouble("amounttosend",   0.0001d);
  this.transactionFee = obj.getDouble("transactionfee", 0.0001d);
}

代码示例来源:origin: com.lordofthejars.diferencia/diferencia-java-core

this.diferenciaConfiguration.storeResults = configuration.getString("storeResults", null);
this.diferenciaConfiguration.differenceMode = DiferenciaMode.valueOf(configuration.getString("differenceMode", "").toUpperCase());
this.diferenciaConfiguration.noiseDetection = configuration.getBoolean("noiseDetection", false);
this.diferenciaConfiguration.mirroring = configuration.getBoolean("mirroring", false);
this.diferenciaConfiguration.returnResult = configuration.getBoolean("returnResult", false);
this.diferenciaConfiguration.headers = configuration.getBoolean("headers", false);
diferenciaConfiguration.allowUnsafeOperations = configuration.getBoolean("allowUnsafeOperartions", false);
diferenciaConfiguration.insecureSkipVerify = configuration.getBoolean("insecureSkipVerify", false);
diferenciaConfiguration.caCert = configuration.getString("caCert", null);
diferenciaConfiguration.clientCert = configuration.getString("clientCert", null);
diferenciaConfiguration.clientKey = configuration.getString("clientKey", null);
diferenciaConfiguration.prometheus = configuration.getBoolean("prometheus", false);
diferenciaConfiguration.forcePlainText = configuration.getBoolean("forcePlainText", false);

代码示例来源:origin: org.activecomponents.jadex/jadex-json

try {
  JsonObject obj = (JsonObject) object;
  boolean isPresent = obj.getBoolean("isPresent", false);
  if (isPresent) {
    JsonValue subJson = obj.get("subobject");

代码示例来源:origin: org.activecomponents.jadex/jadex-json

boolean subcl = obj.getBoolean("subclassed", false);

代码示例来源:origin: dernasherbrezon/r2cloud

@Test
public void testSaveAndLoad() {
  String apiKey = UUID.randomUUID().toString();
  boolean syncSpectogram = true;
  client.saveR2CloudConfiguration(apiKey, syncSpectogram);
  JsonObject config = client.getR2CloudConfiguration();
  assertEquals(apiKey, config.getString("apiKey", null));
  assertTrue(config.getBoolean("syncSpectogram", false));
}

代码示例来源:origin: eclipse/leshan

@Override
  public ResourceModel deserialize(JsonObject o) {
    if (o == null)
      return null;

    if (!o.isObject())
      return null;

    int id = o.getInt("id", -1);
    if (id < 0)
      return null;

    String name = o.getString("name", null);
    Operations operations = Operations.valueOf(o.getString("operations", null));
    String instancetype = o.getString("instancetype", null);
    boolean mandatory = o.getBoolean("mandatory", false);
    Type type = Type.valueOf(o.getString("type", "").toUpperCase());
    String range = o.getString("range", null);
    String units = o.getString("units", null);
    String description = o.getString("description", null);

    return new ResourceModel(id, name, operations, "multiple".equals(instancetype), mandatory, type, range, units,
        description);
  }
}

代码示例来源:origin: eclipse/leshan

@Override
  public ObjectModel deserialize(JsonObject o) {
    if (o == null)
      return null;

    if (!o.isObject())
      return null;

    int id = o.getInt("id", -1);
    if (id < 0)
      return null;

    String name = o.getString("name", null);
    String instancetype = o.getString("instancetype", null);
    boolean mandatory = o.getBoolean("mandatory", false);
    String description = o.getString("description", null);
    String version = o.getString("version", ObjectModel.DEFAULT_VERSION);
    List<ResourceModel> resourceSpecs = resourceModelSerDes.deserialize(o.get("resourcedefs").asArray());

    return new ObjectModel(id, name, description, version, "multiple".equals(instancetype), mandatory,
        resourceSpecs);
  }
}

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

this.twitter            = obj.getString("twitter",            "");
this.isAnonymous        = obj.getBoolean("isanonymous",       false);
this.isGroup            = obj.getBoolean("isgroup",           false);
this.threadID           = obj.getString("threadid",           "");

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

this.twitter            = obj.getString("twitter",            "");	
this.isAnonymous        = obj.getBoolean("isanonymous",       false);
this.isGroup            = obj.getBoolean("isgroup",           false);
this.threadID           = obj.getString("threadid",           "");

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

public void copyFromJSONObject(JsonObject obj)
{
  // Wire protocol fields
  this.version       = obj.getInt("ver",              1);
  this.from          = obj.getString("from",          "");
  this.message       = obj.getString("message",       "");
  this.sign          = obj.getString("sign",          "");
  this.threadID      = obj.getString("threadid",      "");	
  this.returnAddress = obj.getString("returnaddress", "");
  
  // Additional fields - may be missing, get default values
  this.transactionID = obj.getString("transactionID", "");
  this.time          = new Date(obj.getLong("time",   0));
  this.direction     = DIRECTION_TYPE.valueOf(
               obj.getString("direction", DIRECTION_TYPE.RECEIVED.toString()));
  this.verification  = VERIFICATION_TYPE.valueOf(
               obj.getString("verification", VERIFICATION_TYPE.UNVERIFIED.toString()));
  
  if (obj.get("isanonymous") != null)
  {
    this.isAnonymous = obj.getBoolean("isanonymous", false);
  } else
  {
    // Determine from content if it is anonymous
    this.isAnonymous = obj.get("threadid") != null; 
  }
}

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

public void copyFromJSONObject(JsonObject obj)
{
  // Wire protocol fields
  this.version       = obj.getInt("ver",              1);
  this.from          = obj.getString("from",          "");
  this.message       = obj.getString("message",       "");
  this.sign          = obj.getString("sign",          "");
  this.threadID      = obj.getString("threadid",      "");
  this.returnAddress = obj.getString("returnaddress", "");
  // Additional fields - may be missing, get default values
  this.transactionID = obj.getString("transactionID", "");
  this.time          = new Date(obj.getLong("time",   0));
  this.direction     = DIRECTION_TYPE.valueOf(
      obj.getString("direction", DIRECTION_TYPE.RECEIVED.toString()));
  this.verification  = VERIFICATION_TYPE.valueOf(
      obj.getString("verification", VERIFICATION_TYPE.UNVERIFIED.toString()));
  if (obj.get("isanonymous") != null)
  {
    this.isAnonymous = obj.getBoolean("isanonymous", false);
  } else
  {
    // Determine from content if it is anonymous
    this.isAnonymous = obj.get("threadid") != null;
  }
}

相关文章