org.apache.sling.commons.json.JSONObject.optBoolean()方法的使用及代码示例

x33g5p2x  于2022-01-22 转载在 其他  
字(1.7k)|赞(0)|评价(0)|浏览(95)

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

JSONObject.optBoolean介绍

[英]Get an optional boolean associated with a key. It returns false if there is no such key, or if the value is not Boolean.TRUE or the String "true".
[中]获取与键关联的可选布尔值。如果没有这样的键,或者该值不是布尔值,则返回false。TRUE或字符串“TRUE”。

代码示例

代码示例来源:origin: org.apache.sling/org.apache.sling.commons.json

/**
 * Get an optional boolean associated with a key.
 * It returns false if there is no such key, or if the value is not
 * Boolean.TRUE or the String "true".
 *
 * @param key   A key string.
 * @return      The truth.
 */
public boolean optBoolean(String key) {
  return optBoolean(key, false);
}

代码示例来源:origin: org.apache.sling/org.apache.sling.commons.json

sb.append(escape(o.getString("path")));
if (o.optBoolean("secure")) {
  sb.append(";secure");

代码示例来源:origin: Adobe-Consulting-Services/acs-aem-tools

final JSONObject item = jsonArray.getJSONObject(i);
boolean isMulti = item.optBoolean("multi", false);
String name = item.optString("name", "");

代码示例来源:origin: com.adobe.acs/acs-aem-commons-bundle

properties.put("batchSize", params.optInt("batchSize", 10));
properties.put("purgeWorkflow", params.optBoolean("purgeWorkflow", false));
properties.put("autoThrottle", params.optBoolean("autoThrottle", true));

代码示例来源:origin: com.adobe.acs/acs-aem-commons-bundle

if (config.optBoolean("includeDefault")) {
  config = underlay(config, resource.getResourceResolver().getResource(DEFAULT_CONFIG));

相关文章