com.atlassian.jira.util.json.JSONObject.remove()方法的使用及代码示例

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

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

JSONObject.remove介绍

[英]Remove a name and its value, if present.
[中]删除名称及其值(如果存在)。

代码示例

代码示例来源:origin: com.atlassian.jira/jira-core

@Override
public void removeDismissFlagForUser(final String flagKey, final ApplicationUser user)
{
  if (user != null && isNotBlank(flagKey))
  {
    JSONObject dismissals = getDismissalsForUser(user);
    dismissals.remove(flagKey);
    setDismissalsForUser(user, dismissals);
  }
}

代码示例来源:origin: com.atlassian.jira/jira-api

/**
 * 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(final String key, final Object value) throws JSONException
{
  if (key == null)
  {
    throw new JSONException("Null key.");
  }
  if (value != null)
  {
    testValidity(value);
    map.put(key, value);
  }
  else
  {
    remove(key);
  }
  return this;
}

相关文章