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

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

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

JsonParser.getBigDecimal介绍

[英]Returns a JSON number as a BigDecimal. The BigDecimalis created using new BigDecimal(getString()). This method should only called when the parser state is Event#VALUE_NUMBER.
[中]以BigDecimal形式返回JSON数字。使用新的BigDecimal(getString())创建的BigDecimal。仅当解析器状态为Event#VALUE _NUMBER时,才应调用此方法。

代码示例

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

@Override
public BigDecimal getBigDecimal() {
  return jsonParser.getBigDecimal();
}

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

@Override
public BigDecimal getBigDecimal() {
  return jsonParser.getBigDecimal();
}

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

@Override
public BigDecimal getBigDecimal() {
  return jsonParser.getBigDecimal();
}

代码示例来源:origin: org.ovirt.engine.api/metamodel-runtime

/**
 * Reads an integer value from the JSON parser.
 */
public BigInteger readInteger() {
  JsonParser.Event event = parser.next();
  switch (event) {
  case VALUE_NUMBER:
    return parser.getBigDecimal().toBigInteger();
  default:
    throw new JsonException("Expected integer value");
  }
}

代码示例来源:origin: org.ovirt.engine.api/metamodel-runtime

/**
 * Reads a decimal value from the JSON parser.
 */
public BigDecimal readDecimal() {
  JsonParser.Event event = parser.next();
  switch (event) {
  case VALUE_NUMBER:
    return parser.getBigDecimal();
  default:
    throw new JsonException("Expected decimal value");
  }
}

代码示例来源:origin: org.ovirt.engine.api/metamodel-runtime

/**
 * Reads a list of integers from JSON parser. Skips unexpected values.
 */
public List<BigInteger> readIntegers() {
  List<BigInteger> list = new ArrayList<>();
  expect(JsonParser.Event.START_ARRAY);
  boolean listEnd = false;
  while (!listEnd) {
    JsonParser.Event next = next();
    switch (next) {
      case VALUE_NUMBER:
        list.add(parser.getBigDecimal().toBigInteger());
        break;
      case END_ARRAY:
        listEnd = true;
        break;
      default:
        continue;
    }
  }
  return list;
}

代码示例来源:origin: org.ovirt.engine.api/metamodel-runtime

/**
 * Reads a list of decimals from JSON parser. Skips unexpected values.
 */
public List<BigDecimal> readDecimals() {
  List<BigDecimal> list = new ArrayList<>();
  expect(JsonParser.Event.START_ARRAY);
  boolean listEnd = false;
  while (!listEnd) {
    JsonParser.Event next = next();
    switch (next) {
      case VALUE_NUMBER:
        list.add(parser.getBigDecimal());
        break;
      case END_ARRAY:
        listEnd = true;
        break;
      default:
        continue;
    }
  }
  return list;
}

代码示例来源:origin: dcm4che/dcm4che

private List<Object> readValues() {
  ArrayList<Object> list = new ArrayList<>();
  next();
  expect(Event.START_ARRAY);
  while (next() != Event.END_ARRAY) {
    switch (event) {
      case START_OBJECT:
        list.add(readItemOrPersonName());
        break;
      case VALUE_STRING:
        list.add(parser.getString());
        break;
      case VALUE_NUMBER:
        list.add(parser.getBigDecimal());
        break;
      case VALUE_NULL:
        list.add(null);
        break;
      default:
        throw new JsonParsingException("Unexpected " + event, parser.getLocation());
    }
  }
  return list;
}

代码示例来源:origin: owlike/genson

case VALUE_NUMBER:
 if (parser.isIntegralNumber()) objectBuilder.add(name, parser.getLong());
 else objectBuilder.add(name, parser.getBigDecimal());
 break;
case VALUE_NULL:

代码示例来源:origin: com.owlike/genson

case VALUE_NUMBER:
 if (parser.isIntegralNumber()) objectBuilder.add(name, parser.getLong());
 else objectBuilder.add(name, parser.getBigDecimal());
 break;
case VALUE_NULL:

代码示例来源:origin: beckchr/staxon

@Override
public Value value() throws IOException {
  switch (consume(JsonStreamToken.VALUE)) {
  case VALUE_STRING:
    return new Value(parser.getString());
  case VALUE_TRUE:
    return TRUE;
  case VALUE_FALSE:
    return FALSE;
  case VALUE_NUMBER:
    if (parser.isIntegralNumber()) {
      return new Value(parser.getString(), Long.valueOf(parser.getLong()));
    } else {
      return new Value(parser.getString(), parser.getBigDecimal());
    }
  case VALUE_NULL:
    return NULL;
  default:
    throw new IllegalStateException("Unexpected event");
  }
}

代码示例来源:origin: org.opendaylight.aaa/aaa-authn-idpmapping

return parser.getLong();
} else {
  return parser.getBigDecimal().doubleValue();

代码示例来源:origin: com.haulmont.thirdparty/eclipselink

top.add(jp.getBigDecimal());
break;

代码示例来源:origin: apache/activemq-artemis

builder.add(key, new JsonLongImpl(parser.getLong()));
} else {
  builder.add(key, new JsonNumberImpl(parser.getBigDecimal()));

代码示例来源:origin: org.apache.activemq/artemis-jms-client-all

builder.add(key, new JsonLongImpl(parser.getLong()));
} else {
  builder.add(key, new JsonNumberImpl(parser.getBigDecimal()));

代码示例来源:origin: apache/activemq-artemis

builder.add(key, new JsonLongImpl(parser.getLong()));
} else {
  builder.add(key, new JsonNumberImpl(parser.getBigDecimal()));

代码示例来源:origin: owlike/genson

case VALUE_NUMBER:
 if (parser.isIntegralNumber()) arrayBuilder.add(parser.getLong());
 else arrayBuilder.add(parser.getBigDecimal());
 break;
case VALUE_NULL:

代码示例来源:origin: com.owlike/genson

case VALUE_NUMBER:
 if (parser.isIntegralNumber()) arrayBuilder.add(parser.getLong());
 else arrayBuilder.add(parser.getBigDecimal());
 break;
case VALUE_NULL:

代码示例来源:origin: apache/activemq-artemis

builder.add(new JsonLongImpl(parser.getLong()));
} else {
  builder.add(new JsonNumberImpl(parser.getBigDecimal()));

代码示例来源:origin: apache/activemq-artemis

builder.add(new JsonLongImpl(parser.getLong()));
} else {
  builder.add(new JsonNumberImpl(parser.getBigDecimal()));

相关文章