本文整理汇总了Java中com.fasterxml.jackson.databind.node.BigIntegerNode类的典型用法代码示例。如果您正苦于以下问题:Java BigIntegerNode类的具体用法?Java BigIntegerNode怎么用?Java BigIntegerNode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BigIntegerNode类属于com.fasterxml.jackson.databind.node包,在下文中一共展示了BigIntegerNode类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: get
import com.fasterxml.jackson.databind.node.BigIntegerNode; //导入依赖的package包/类
public static PrimitiveObject get( final JsonNode jsonNode ) throws IOException{
if( jsonNode instanceof TextNode ){
return new StringObj( ( (TextNode)jsonNode ).textValue() );
}
else if( jsonNode instanceof BooleanNode ){
return new BooleanObj( ( (BooleanNode)jsonNode ).booleanValue() );
}
else if( jsonNode instanceof IntNode ){
return new IntegerObj( ( (IntNode)jsonNode ).intValue() );
}
else if( jsonNode instanceof LongNode ){
return new LongObj( ( (LongNode)jsonNode ).longValue() );
}
else if( jsonNode instanceof DoubleNode ){
return new DoubleObj( ( (DoubleNode)jsonNode ).doubleValue() );
}
else if( jsonNode instanceof BigIntegerNode ){
return new StringObj( ( (BigIntegerNode)jsonNode ).bigIntegerValue().toString() );
}
else if( jsonNode instanceof DecimalNode ){
return new StringObj( ( (DecimalNode)jsonNode ).decimalValue().toString() );
}
else if( jsonNode instanceof BinaryNode ){
return new BytesObj( ( (BinaryNode)jsonNode ).binaryValue() );
}
else if( jsonNode instanceof POJONode ){
return new BytesObj( ( (POJONode)jsonNode ).binaryValue() );
}
else if( jsonNode instanceof NullNode ){
return NullObj.getInstance();
}
else if( jsonNode instanceof MissingNode ){
return NullObj.getInstance();
}
else{
return new StringObj( jsonNode.toString() );
}
}
开发者ID:yahoojapan,项目名称:dataplatform-schema-lib,代码行数:39,代码来源:JsonNodeToPrimitiveObject.java
示例2: emitJsonNode
import com.fasterxml.jackson.databind.node.BigIntegerNode; //导入依赖的package包/类
private static void emitJsonNode(StringBuilder buf, JsonNode node) {
if (node.isNumber()) {
// Formatting of numbers depending on type
switch (node.numberType()) {
case BIG_INTEGER:
buf.append(((BigIntegerNode)node).bigIntegerValue().toString());
break;
case BIG_DECIMAL:
buf.append(((DecimalNode)node).decimalValue().toPlainString());
break;
case INT:
case LONG:
buf.append(node.asLong());
break;
case FLOAT:
case DOUBLE:
double val = node.asDouble();
buf.append(Double.toString(val));
break;
default:
break;
}
} else if (node.isArray()) {
// JavaScript Array.toString() will comma-delimit the elements.
for (int i = 0, size = node.size(); i < size; i++) {
if (i >= 1) {
buf.append(",");
}
buf.append(node.path(i).asText());
}
} else if (!node.isNull() && !node.isMissingNode()) {
buf.append(node.asText());
}
}
开发者ID:Squarespace,项目名称:template-compiler,代码行数:41,代码来源:Instructions.java
示例3: unwrap
import com.fasterxml.jackson.databind.node.BigIntegerNode; //导入依赖的package包/类
public static Object unwrap(Object val) { // Can Jackson do this via
// ObjectMapper.treeToValue()? The
// spec is unclear
Object result = val;
ObjectMapper mapper = new ObjectMapper();
if (val instanceof ObjectNode) {
result = mapper.convertValue((ObjectNode) val, Map.class);
} else if (val instanceof ArrayNode) {
result = mapper.convertValue((ObjectNode) val, List.class);
} else if (val instanceof NullNode) {
result = null;
} else if (val instanceof BooleanNode) {
result = ((BooleanNode) val).booleanValue();
} else if (val instanceof ShortNode) {
result = ((ShortNode) val).shortValue();
} else if (val instanceof IntNode) {
result = ((IntNode) val).intValue();
} else if (val instanceof LongNode) {
result = ((LongNode) val).longValue();
} else if (val instanceof DoubleNode) {
result = ((DoubleNode) val).doubleValue();
} else if (val instanceof FloatNode) {
result = ((FloatNode) val).floatValue();
} else if (val instanceof BigIntegerNode) {
result = ((BigIntegerNode) val).bigIntegerValue();
} else if (val instanceof DecimalNode) {
result = ((DecimalNode) val).decimalValue();
}
return result;
}
开发者ID:sassoftware,项目名称:unravl,代码行数:31,代码来源:Json.java
示例4: IntegerValidator
import com.fasterxml.jackson.databind.node.BigIntegerNode; //导入依赖的package包/类
public void IntegerValidator() {
intTypes.add(IntNode.class);
intTypes.add(ShortNode.class);
intTypes.add(BigIntegerNode.class);
}
开发者ID:networknt,项目名称:openapi-parser,代码行数:6,代码来源:IntegerValidator.java
示例5: decodeByType
import com.fasterxml.jackson.databind.node.BigIntegerNode; //导入依赖的package包/类
private Result decodeByType(Type type, int offset, int size)
throws IOException {
// MAP, ARRAY, and BOOLEAN do not use newOffset as we don't read the
// next <code>size</code> bytes. For all other types, we do.
int newOffset = offset + size;
switch (type) {
case MAP:
return this.decodeMap(size, offset);
case ARRAY:
return this.decodeArray(size, offset);
case BOOLEAN:
return new Result(Decoder.decodeBoolean(size), offset);
case UTF8_STRING:
TextNode s = new TextNode(this.decodeString(size));
return new Result(s, newOffset);
case DOUBLE:
return new Result(this.decodeDouble(), newOffset);
case FLOAT:
return new Result(this.decodeFloat(), newOffset);
case BYTES:
BinaryNode b = new BinaryNode(this.getByteArray(size));
return new Result(b, newOffset);
case UINT16:
IntNode i = this.decodeUint16(size);
return new Result(i, newOffset);
case UINT32:
LongNode l = this.decodeUint32(size);
return new Result(l, newOffset);
case INT32:
IntNode int32 = this.decodeInt32(size);
return new Result(int32, newOffset);
case UINT64:
BigIntegerNode bi = this.decodeBigInteger(size);
return new Result(bi, newOffset);
case UINT128:
BigIntegerNode uint128 = this.decodeBigInteger(size);
return new Result(uint128, newOffset);
default:
throw new InvalidDatabaseException(
"Unknown or unexpected type: " + type.name());
}
}
开发者ID:mervin0502,项目名称:Lizard,代码行数:44,代码来源:Decoder.java
示例6: decodeBigInteger
import com.fasterxml.jackson.databind.node.BigIntegerNode; //导入依赖的package包/类
private BigIntegerNode decodeBigInteger(int size) {
byte[] bytes = this.getByteArray(size);
return new BigIntegerNode(new BigInteger(1, bytes));
}
开发者ID:mervin0502,项目名称:Lizard,代码行数:5,代码来源:Decoder.java
注:本文中的com.fasterxml.jackson.databind.node.BigIntegerNode类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论