本文整理了Java中org.apache.sling.commons.json.JSONObject.remove()
方法的一些代码示例,展示了JSONObject.remove()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JSONObject.remove()
方法的具体详情如下:
包路径:org.apache.sling.commons.json.JSONObject
类名称:JSONObject
方法名:remove
[英]Remove a name and its value, if present.
[中]删除名称及其值(如果存在)。
代码示例来源:origin: org.apache.sling/org.apache.sling.commons.json
/**
* Put a key/value pair in the JSONObject. If the value is null,
* then the key will be removed from the JSONObject if it is present.
* @param key A key string.
* @param value An object which is the value. It should be of one of these
* types: Boolean, Double, Integer, JSONArray, JSONObject, Long, String,
* or the JSONObject.NULL object.
* @return this.
* @throws JSONException If the value is non-finite number
* or if the key is null.
*/
public JSONObject put(String key, Object value) throws JSONException {
if (key == null) {
throw new JSONException("Null key.");
}
if (value != null) {
testValidity(value);
this.myHashMap.put(key, value);
} else {
remove(key);
}
return this;
}
代码示例来源:origin: com.adobe.acs/acs-aem-commons-bundle
widget.remove("hideLabel");
内容来源于网络,如有侵权,请联系作者删除!