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

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

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

JSONObject.getInt介绍

[英]Get the int value associated with a key. If the number value is too large for an int, it will be clipped.
[中]获取与键关联的int值。如果数值对于int太大,则将对其进行剪裁。

代码示例

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

/**
 * Get an optional int value associated with a key,
 * or the default 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.
 * @param defaultValue The default.
 * @return An object which is the value.
 */
public int optInt(final String key, final int defaultValue)
{
  try
  {
    return getInt(key);
  }
  catch (final Exception e)
  {
    return defaultValue;
  }
}

代码示例来源:origin: com.atlassian.plugin.deflection/deflection-cse

numberOfResults));
if ((page - 1) > searchResult.getJSONObject("cursor").getInt("currentPageIndex"))

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

@Override
  public AttachmentArchiveEntry apply(final JSONObject jsonObject)
  {
    try
    {
      return new AttachmentArchiveEntryBuilder()
          .entryIndex(jsonObject.getInt("entryIndex"))
          .name(jsonObject.getString("name"))
          .size(jsonObject.getLong("size"))
          .mediaType(jsonObject.getString("mediaType"))
          .build();
    }
    catch (final JSONException e)
    {
      throw new RuntimeException(e);
    }
  }
};

代码示例来源:origin: com.atlassian.jirawallboard/atlassian-wallboard-plugin

static public WallboardPluginSettings loadSettings(PluginSettingsFactory pluginSettingsFactory, ApplicationUser user)
{
  WallboardPluginSettings settings = new WallboardPluginSettings(pluginSettingsFactory, user);
  Object val = pluginSettingsFactory.createGlobalSettings().get(WALLBOARD_KEY + mapNullToBlank(settings.userKey));
  if (val == null)
  {
    settings.isConfigured = false;
    return settings;
  }
  JSONObject jsonRepresentation;
  try
  {
    jsonRepresentation = new JSONObject((String) val);
    JSONArray rawDashboardIds = jsonRepresentation.getJSONArray("dashboardIds");
    settings.dashboardIds = new ArrayList<>(rawDashboardIds.length());
    for (int i = 0; i < rawDashboardIds.length(); i++)
    {
      settings.dashboardIds.add(i, (String) rawDashboardIds.get(i));
    }
    settings.setCyclePeriod(jsonRepresentation.getInt(WallboardServlet.CYCLE_PERIOD.getKey()));
    settings.setTransitionFx(jsonRepresentation.getString(WallboardServlet.TRANSITION_FX.getKey()));
    settings.setRandom(jsonRepresentation.getBoolean(WallboardServlet.RANDOM.getKey()));
  }
  catch (JSONException e)
  {
    settings.isConfigured = false;
  }
  return settings;
}

代码示例来源:origin: com.marvelution.jira.plugins/jira-jenkins-plugin

build.setTestResults(new TestResults(object.getInt("failCount"), object.getInt("skipCount"),
                   object.getInt("totalCount")));

代码示例来源:origin: com.marvelution.jira.plugins/jira-jenkins-plugin

for (int index = 0; index < builds.length(); index++) {
  final JSONObject jsonBuild = builds.getJSONObject(index);
  final Build build = new Build(job.getId(), jsonBuild.getInt("number"));
  job.getBuilds().add(build);

相关文章