本文整理了Java中com.atlassian.jira.util.json.JSONArray.getLong()
方法的一些代码示例,展示了JSONArray.getLong()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JSONArray.getLong()
方法的具体详情如下:
包路径:com.atlassian.jira.util.json.JSONArray
类名称:JSONArray
方法名:getLong
[英]Get the long value associated with an index.
[中]获取与索引关联的长值。
代码示例来源:origin: com.atlassian.jira/jira-api
/**
* Get the optional long value associated with an index.
* The defaultValue is returned if there is no value for the index,
* or if the value is not a number and cannot be converted to a number.
*
* @param index The index must be between 0 and length() - 1.
* @param defaultValue The default value.
* @return The value.
*/
public long optLong(final int index, final long defaultValue)
{
try
{
return getLong(index);
}
catch (final Exception e)
{
return defaultValue;
}
}
代码示例来源:origin: com.atlassian.jira/jira-api
private static Collection<Long> getRoleIds(final JSONArray jsonArray) throws JSONException
{
Set<Long> roleIds = Sets.newHashSetWithExpectedSize(jsonArray.length());
for (int i = 0 ; i<jsonArray.length(); i++)
{
roleIds.add(jsonArray.getLong(i));
}
return roleIds;
}
代码示例来源:origin: com.atlassian.jira/jira-core
private List<SearchRequest> toSearchRequests(final ApplicationUser user, final JSONObject json) throws JSONException
{
final JSONArray jsonArray = json.getJSONArray(IDS);
final List<SearchRequest> filters = Lists.newArrayList();
for (int i = 0; i < jsonArray.length(); i++)
{
final long filterId = jsonArray.getLong(i);
final SearchRequest filter = searchRequestService.getFilter(new JiraServiceContextImpl(user), filterId);
if (filter != null)
{
filters.add(filter);
}
}
return ImmutableList.copyOf(filters);
}
内容来源于网络,如有侵权,请联系作者删除!