本文整理了Java中javax.json.stream.JsonParser.isIntegralNumber()
方法的一些代码示例,展示了JsonParser.isIntegralNumber()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JsonParser.isIntegralNumber()
方法的具体详情如下:
包路径:javax.json.stream.JsonParser
类名称:JsonParser
方法名:isIntegralNumber
[英]Returns true if the JSON number at the current parser state is a integral number. A BigDecimal may be used to store the value internally and this method semantics are defined using its scale(). If the scale is zero, then it is considered integral type. This integral type information can be used to invoke an appropriate accessor method to obtain a numeric value as in the following example:
JsonParser parser = ...
if (parser.isIntegralNumber()) {
parser.getInt(); // or other methods to get integral value
} else {
parser.getBigDecimal();
}
[中]如果当前解析器状态下的JSON编号是整数,则返回true。BigDecimal可用于在内部存储值,此方法语义是使用其scale()定义的。如果标度为零,则将其视为整型。此整型信息可用于调用适当的访问器方法以获取数值,如以下示例所示:
JsonParser parser = ...
if (parser.isIntegralNumber()) {
parser.getInt(); // or other methods to get integral value
} else {
parser.getBigDecimal();
}
代码示例来源:origin: org.apache.johnzon/johnzon-core
@Override
public boolean isIntegralNumber() {
return jsonParser.isIntegralNumber();
}
代码示例来源:origin: org.eclipse/yasson
@Override
public boolean isIntegralNumber() {
return jsonParser.isIntegralNumber();
}
代码示例来源:origin: apache/johnzon
@Override
public boolean isIntegralNumber() {
return jsonParser.isIntegralNumber();
}
代码示例来源: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: owlike/genson
break;
case VALUE_NUMBER:
if (parser.isIntegralNumber()) objectBuilder.add(name, parser.getLong());
else objectBuilder.add(name, parser.getBigDecimal());
break;
代码示例来源:origin: com.owlike/genson
break;
case VALUE_NUMBER:
if (parser.isIntegralNumber()) objectBuilder.add(name, parser.getLong());
else objectBuilder.add(name, parser.getBigDecimal());
break;
代码示例来源: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
if (parser.isIntegralNumber()) {
return parser.getLong();
} else {
代码示例来源:origin: apache/activemq-artemis
if (parser.isIntegralNumber()) {
builder.add(key, new JsonLongImpl(parser.getLong()));
} else {
代码示例来源:origin: apache/activemq-artemis
if (parser.isIntegralNumber()) {
builder.add(key, new JsonLongImpl(parser.getLong()));
} else {
代码示例来源:origin: org.apache.activemq/artemis-jms-client-all
if (parser.isIntegralNumber()) {
builder.add(key, new JsonLongImpl(parser.getLong()));
} else {
代码示例来源:origin: dsukhoroslov/bagri
break;
case VALUE_NUMBER:
if (parser.isIntegralNumber()) {
ctx.addValue(parser.getLong());
} else {
代码示例来源:origin: com.owlike/genson
break;
case VALUE_NUMBER:
if (parser.isIntegralNumber()) arrayBuilder.add(parser.getLong());
else arrayBuilder.add(parser.getBigDecimal());
break;
代码示例来源:origin: owlike/genson
break;
case VALUE_NUMBER:
if (parser.isIntegralNumber()) arrayBuilder.add(parser.getLong());
else arrayBuilder.add(parser.getBigDecimal());
break;
代码示例来源:origin: apache/activemq-artemis
if (parser.isIntegralNumber()) {
builder.add(new JsonLongImpl(parser.getLong()));
} else {
代码示例来源:origin: apache/activemq-artemis
if (parser.isIntegralNumber()) {
builder.add(new JsonLongImpl(parser.getLong()));
} else {
代码示例来源:origin: org.apache.activemq/artemis-jms-client-all
if (parser.isIntegralNumber()) {
builder.add(new JsonLongImpl(parser.getLong()));
} else {
内容来源于网络,如有侵权,请联系作者删除!