本文整理了Java中com.fasterxml.jackson.databind.JsonNode.bigIntegerValue()
方法的一些代码示例,展示了JsonNode.bigIntegerValue()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JsonNode.bigIntegerValue()
方法的具体详情如下:
包路径:com.fasterxml.jackson.databind.JsonNode
类名称:JsonNode
方法名:bigIntegerValue
[英]Returns integer value for this node (as BigDecimal), if and only if this node is numeric ( #isNumber returns true). For other types returns BigInteger.ZERO
.
[中]返回此节点的整数值(作为BigDecimal),当且仅当此节点为数值(#isNumber返回true)。对于其他类型,返回BigInteger.ZERO
。
代码示例来源:origin: java-json-tools/json-schema-validator
@Override
public int compare(final JsonNode o1, final JsonNode o2)
{
return o1.bigIntegerValue().compareTo(o2.bigIntegerValue());
}
};
代码示例来源:origin: redisson/redisson
@Override
public BigInteger getBigIntegerValue() throws IOException, JsonParseException
{
return currentNumericNode().bigIntegerValue();
}
代码示例来源:origin: java-json-tools/json-schema-validator
public DivisorsKeywordValidator(final JsonNode digest)
{
super("divisors");
final ImmutableList.Builder<BigInteger> list
= ImmutableList.builder();
for (final JsonNode element: digest)
list.add(element.bigIntegerValue());
divisors = list.build();
}
代码示例来源:origin: java-json-tools/json-schema-validator
@Override
public void validate(final Processor<FullData, FullData> processor,
final ProcessingReport report, final MessageBundle bundle,
final FullData data)
throws ProcessingException
{
final BigInteger value
= data.getInstance().getNode().bigIntegerValue();
/*
* We use a plain list to store failed divisors: remember that the
* digested form was built with divisors in order, we therefore
* only need insertion order, and a plain ArrayList guarantees that.
*/
final List<BigInteger> failed = Lists.newArrayList();
for (final BigInteger divisor: divisors)
if (!value.mod(divisor).equals(BigInteger.ZERO))
failed.add(divisor);
if (failed.isEmpty())
return;
/*
* There are missed divisors: report.
*/
report.error(newMsg(data, bundle, "missingDivisors")
.put("divisors", divisors).put("failed", failed));
}
代码示例来源:origin: org.springframework.boot/spring-boot
return (D) jsonNode.bigIntegerValue();
代码示例来源:origin: java-json-tools/json-schema-validator
@Override
public void validate(final ProcessingReport report,
final MessageBundle bundle, final FullData data)
throws ProcessingException
{
final JsonNode instance = data.getInstance().getNode();
BigInteger epoch = instance.bigIntegerValue();
if (epoch.signum() == -1) {
report.warn(newMsg(data, bundle, "warn.format.epoch.negative")
.putArgument("value", instance));
return;
}
epoch = epoch.divide(ONE_THOUSAND);
if (epoch.bitLength() > EPOCH_BITLENGTH)
report.warn(newMsg(data, bundle, "warn.format.epoch.overflow")
.putArgument("value", instance));
}
}
代码示例来源:origin: java-json-tools/json-schema-validator
private static Object valueToArgument(final JsonNode value)
{
final NodeType type = NodeType.getNodeType(value);
switch (type) {
case STRING:
return value.textValue();
case INTEGER:
return value.bigIntegerValue();
case NUMBER: case NULL: case OBJECT: case ARRAY:
return value;
case BOOLEAN:
return value.booleanValue();
// case ARRAY:
// final List<Object> list = Lists.newArrayList();
// for (final JsonNode element: value)
// list.add(valueToArgument(element));
// return list;
default:
throw new UnsupportedOperationException();
}
}
}
代码示例来源:origin: java-json-tools/json-schema-validator
private static Object valueToArgument(final JsonNode value)
{
final NodeType type = NodeType.getNodeType(value);
switch (type) {
case STRING:
return value.textValue();
case INTEGER:
return value.bigIntegerValue();
case NUMBER:
return value.decimalValue().toPlainString();
case NULL:
return value;
case BOOLEAN:
return value.booleanValue();
case ARRAY:
final List<Object> list = Lists.newArrayList();
for (final JsonNode element: value)
list.add(valueToArgument(element));
return list;
default:
throw new UnsupportedOperationException();
}
}
}
代码示例来源:origin: java-json-tools/json-schema-validator
.put("expected", NodeType.INTEGER)
.put("found", type));
else if (element.bigIntegerValue().compareTo(BigInteger.ONE) < 0)
report.error(newMsg(tree, bundle, "integerIsNegative")
.put("value", element));
代码示例来源:origin: org.kitchen-eel/json-schema-validator
public DivisorsKeywordValidator(final JsonNode schema)
{
super("divisors", NodeType.INTEGER);
/*
* Use Google's ImmutableSet
*/
final ImmutableSet.Builder<BigInteger> set = ImmutableSet.builder();
for (final JsonNode element: schema.get(keyword))
set.add(element.bigIntegerValue());
divisors = set.build();
}
代码示例来源:origin: hstaudacher/osgi-jax-rs-connector
@Override
public BigInteger getBigIntegerValue() throws IOException, JsonParseException
{
return currentNumericNode().bigIntegerValue();
}
代码示例来源:origin: com.fasterxml.jackson.core/com.springsource.com.fasterxml.jackson.core.jackson-databind
@Override
public BigInteger getBigIntegerValue() throws IOException, JsonParseException
{
return currentNumericNode().bigIntegerValue();
}
代码示例来源:origin: Nextdoor/bender
@Override
public BigInteger getBigIntegerValue() throws IOException, JsonParseException
{
return currentNumericNode().bigIntegerValue();
}
代码示例来源:origin: com.eclipsesource.jaxrs/jersey-all
@Override
public BigInteger getBigIntegerValue() throws IOException, JsonParseException
{
return currentNumericNode().bigIntegerValue();
}
代码示例来源:origin: com.jwebmp.jackson.core/jackson-databind
@Override
public BigInteger getBigIntegerValue() throws IOException, JsonParseException
{
return currentNumericNode().bigIntegerValue();
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-analytics
@Override
public BigInteger getBigIntegerValue() throws IOException, JsonParseException
{
return currentNumericNode().bigIntegerValue();
}
代码示例来源:origin: apache/streams
protected ChannelStatistics setChannelStatistics(JsonNode node) {
ChannelStatistics stats = new ChannelStatistics();
if (node == null) {
return stats;
}
stats.setCommentCount(node.get("commentCount").bigIntegerValue());
stats.setHiddenSubscriberCount(node.get("hiddenSubscriberCount").asBoolean());
stats.setSubscriberCount(node.get("subscriberCount").bigIntegerValue());
stats.setVideoCount(node.get("videoCount").bigIntegerValue());
stats.setViewCount(node.get("viewCount").bigIntegerValue());
return stats;
}
代码示例来源:origin: com.redhat.lightblue/lightblue-core-metadata
@Override
public Object fromJson(JsonNode node) {
if (node == null || node instanceof NullNode) {
return null;
} else if (node instanceof TextNode) {
return new BigInteger(node.asText());
}
if (node.isValueNode()) {
return node.bigIntegerValue();
} else {
throw Error.get(NAME, MetadataConstants.ERR_INCOMPATIBLE_VALUE, node.toString());
}
}
代码示例来源:origin: com.redhat.lightblue/metadata
@Override
public Object fromJson(JsonNode node) {
if (node.isValueNode()) {
return node.bigIntegerValue();
} else {
throw Error.get(NAME, MetadataConstants.ERR_INCOMPATIBLE_VALUE, node.toString());
}
}
代码示例来源:origin: io.confluent.kafka/connect-utils
@Override
public Object parseJsonNode(JsonNode input, Schema schema) {
Preconditions.checkState(input.isInt(), "'%s' is not a '%s'", input.textValue(), expectedClass().getSimpleName());
return input.bigIntegerValue().byteValue();
}
}
内容来源于网络,如有侵权,请联系作者删除!