javax.json.stream.JsonParser.getInt()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(1.7k)|赞(0)|评价(0)|浏览(151)

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

JsonParser.getInt介绍

[英]Returns a JSON number as an integer. The returned value is equal to new BigDecimal(getString()).intValue(). Note that this conversion can lose information about the overall magnitude and precision of the number value as well as return a result with the opposite sign. This method should only be called when the parser state is Event#VALUE_NUMBER.
[中]以整数形式返回JSON数字。返回的值等于新的BigDecimal(getString())。intValue()。请注意,此转换可能会丢失有关数值的总体大小和精度的信息,并返回带有相反符号的结果。仅当解析器状态为Event#VALUE _NUMBER时,才应调用此方法。

代码示例

代码示例来源:origin: apache/johnzon

@Override
public int getInt() {
  return jsonParser.getInt();
}

代码示例来源:origin: org.apache.johnzon/johnzon-core

@Override
public int getInt() {
  return jsonParser.getInt();
}

代码示例来源:origin: org.eclipse/yasson

@Override
public int getInt() {
  return jsonParser.getInt();
}

代码示例来源:origin: webex/spark-java-sdk

case VALUE_NUMBER:
  if (field != null) {
    Object value = (parser.isIntegralNumber() ? parser.getInt() : parser.getBigDecimal());
    field.set(result, value);
    field = null;

代码示例来源:origin: radcortez/wow-auctions

protected boolean readAuctionItem(Auction auction) {
  if (parser.getString().equalsIgnoreCase("auc")) {
    parser.next();
    auction.setAuctionId(parser.getLong());
    parser.next();
    parser.next();
    auction.setItemId(parser.getInt());
    parser.next();
    parser.next();
    parser.next();
    parser.next();
    auction.setOwnerRealm(parser.getString());
    parser.next();
    parser.next();
    auction.setBid(parser.getLong());
    parser.next();
    parser.next();
    auction.setBuyout(parser.getLong());
    parser.next();
    parser.next();
    auction.setQuantity(parser.getInt());
    return true;
  }
  return false;
}

相关文章