本文整理了Java中org.apache.sling.commons.json.JSONObject.optInt()
方法的一些代码示例,展示了JSONObject.optInt()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JSONObject.optInt()
方法的具体详情如下:
包路径:org.apache.sling.commons.json.JSONObject
类名称:JSONObject
方法名:optInt
[英]Get an optional int value associated with a key, or zero if there is no such key or if the value is not a number. If the value is a string, an attempt will be made to evaluate it as a number.
[中]获取与键关联的可选int值,如果没有此类键或该值不是数字,则获取零。如果该值是字符串,将尝试将其作为数字计算。
代码示例来源:origin: org.apache.sling/org.apache.sling.commons.json
/**
* Get an optional int value associated with a key,
* or zero if there is no such key or if the value is not a number.
* If the value is a string, an attempt will be made to evaluate it as
* a number.
*
* @param key A key string.
* @return An object which is the value.
*/
public int optInt(String key) {
return optInt(key, 0);
}
代码示例来源:origin: Adobe-Consulting-Services/acs-aem-tools
total = json.optInt("total", 0);
bucketSize = json.optInt("bucketSize", DEFAULT_BUCKET_SIZE);
bucketType = json.optString("bucketType", DEFAULT_BUCKET_TYPE);
saveThreshold = json.optInt("saveThreshold", DEFAULT_SAVE_THRESHOLD);
代码示例来源:origin: com.adobe.acs/acs-aem-commons-bundle
int batchSize = params.optInt(PARAM_BATCH_SIZE);
if (batchSize < 1) {
batchSize = DEFAULT_BATCH_SIZE;
int maxDuration = params.optInt(PARAM_MAX_DURATION);
if (maxDuration < 1) {
maxDuration = DEFAULT_MAX_DURATION;
代码示例来源:origin: com.adobe.acs/acs-aem-commons-bundle
properties.put("relativePath", StringUtils.removeStart(params.optString("relativePath", ""), "/"));
properties.put("workflowModel", params.getString("workflowModelId"));
properties.put("interval", params.optInt("interval", 10));
properties.put("timeout", params.optInt("timeout", 30));
properties.put("throttle", params.optInt("throttle", 10));
properties.put("retryCount", params.optInt("retryCount", 0));
properties.put("batchSize", params.optInt("batchSize", 10));
代码示例来源:origin: com.adobe.acs/acs-aem-commons-bundle
int throttle = params.optInt("throttle", -1);
int interval = params.optInt("interval", -1);
内容来源于网络,如有侵权,请联系作者删除!