• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java BinaryNode类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.fasterxml.jackson.databind.node.BinaryNode的典型用法代码示例。如果您正苦于以下问题:Java BinaryNode类的具体用法?Java BinaryNode怎么用?Java BinaryNode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



BinaryNode类属于com.fasterxml.jackson.databind.node包,在下文中一共展示了BinaryNode类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: get

import com.fasterxml.jackson.databind.node.BinaryNode; //导入依赖的package包/类
public static JsonNode get( final PrimitiveObject obj ) throws IOException{
  switch( obj.getPrimitiveType() ){
    case BOOLEAN:
      return BooleanNode.valueOf( obj.getBoolean() );
    case BYTE:
      return IntNode.valueOf( obj.getInt() );
    case SHORT:
      return IntNode.valueOf( obj.getInt() );
    case INTEGER:
      return IntNode.valueOf( obj.getInt() );
    case LONG:
      return new LongNode( obj.getLong() );
    case FLOAT:
      return new DoubleNode( obj.getDouble() );
    case DOUBLE:
      return new DoubleNode( obj.getDouble() );
    case STRING:
      return new TextNode( obj.getString() );
    case BYTES:
      return new BinaryNode( obj.getBytes() );
    default:
      return new TextNode( null );
  }
}
 
开发者ID:yahoojapan,项目名称:dataplatform-schema-lib,代码行数:25,代码来源:PrimitiveObjectToJsonNode.java


示例2: get

import com.fasterxml.jackson.databind.node.BinaryNode; //导入依赖的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


示例3: get

import com.fasterxml.jackson.databind.node.BinaryNode; //导入依赖的package包/类
public static JsonNode get( final Object obj ) throws IOException{

    if( obj instanceof PrimitiveObject ){
      return PrimitiveObjectToJsonNode.get( (PrimitiveObject)obj );
    }
    else if( obj instanceof String ){
      return new TextNode( (String)obj );
    }
    else if( obj instanceof Boolean ){
      return BooleanNode.valueOf( (Boolean)obj );
    }
    else if( obj instanceof Short ){
      return IntNode.valueOf( ( (Short)obj ).intValue() );
    }
    else if( obj instanceof Integer ){
      return IntNode.valueOf( (Integer)obj );
    }
    else if( obj instanceof Long ){
      return new LongNode( (Long)obj );
    }
    else if( obj instanceof Float ){
      return new DoubleNode( ( (Float)obj ).doubleValue() );
    }
    else if( obj instanceof Double ){
      return new DoubleNode( (Double)obj );
    }
    else if( obj instanceof byte[] ){
      return new BinaryNode( (byte[])obj );
    }
    else if( obj == null ){
      return NullNode.getInstance();
    }
    else{
      return new TextNode( obj.toString() );
    }
  }
 
开发者ID:yahoojapan,项目名称:dataplatform-schema-lib,代码行数:37,代码来源:ObjectToJsonNode.java


示例4: addBytesValue

import com.fasterxml.jackson.databind.node.BinaryNode; //导入依赖的package包/类
public Datapoint addBytesValue(long time, byte[] value) {
    initialValues();
    if (values != null && !values.isEmpty() && (type == null || !type.equals(TsdbConstants.TYPE_BYTES))) {
        throw new IllegalStateException("There is already another type in datapoint, "
                + "could not add byte array type again");
    }
    type = TsdbConstants.TYPE_BYTES;
    values.add(Lists.<JsonNode> newArrayList(new LongNode(time), new BinaryNode(value)));
    return this;
}
 
开发者ID:baidubce,项目名称:bce-sdk-java,代码行数:11,代码来源:Datapoint.java


示例5: decodeByType

import com.fasterxml.jackson.databind.node.BinaryNode; //导入依赖的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: binary

import com.fasterxml.jackson.databind.node.BinaryNode; //导入依赖的package包/类
@Override
public Schema binary(BinaryNode ignored) {
  return Schema.create(Schema.Type.BYTES);
}
 
开发者ID:apache,项目名称:parquet-mr,代码行数:5,代码来源:AvroJson.java


示例7: visit

import com.fasterxml.jackson.databind.node.BinaryNode; //导入依赖的package包/类
private static <T> T visit(JsonNode node, JsonTreeVisitor<T> visitor) {
  switch (node.getNodeType()) {
    case OBJECT:
      Preconditions.checkArgument(node instanceof ObjectNode,
          "Expected instance of ObjectNode: " + node);

      // use LinkedHashMap to preserve field order
      Map<String, T> fields = Maps.newLinkedHashMap();

      Iterator<Map.Entry<String, JsonNode>> iter = node.fields();
      while (iter.hasNext()) {
        Map.Entry<String, JsonNode> entry = iter.next();

        visitor.recordLevels.push(entry.getKey());
        fields.put(entry.getKey(), visit(entry.getValue(), visitor));
        visitor.recordLevels.pop();
      }

      return visitor.object((ObjectNode) node, fields);

    case ARRAY:
      Preconditions.checkArgument(node instanceof ArrayNode,
          "Expected instance of ArrayNode: " + node);

      List<T> elements = Lists.newArrayListWithExpectedSize(node.size());

      for (JsonNode element : node) {
        elements.add(visit(element, visitor));
      }

      return visitor.array((ArrayNode) node, elements);

    case BINARY:
      Preconditions.checkArgument(node instanceof BinaryNode,
          "Expected instance of BinaryNode: " + node);
      return visitor.binary((BinaryNode) node);

    case STRING:
      Preconditions.checkArgument(node instanceof TextNode,
          "Expected instance of TextNode: " + node);

      return visitor.text((TextNode) node);

    case NUMBER:
      Preconditions.checkArgument(node instanceof NumericNode,
          "Expected instance of NumericNode: " + node);

      return visitor.number((NumericNode) node);

    case BOOLEAN:
      Preconditions.checkArgument(node instanceof BooleanNode,
          "Expected instance of BooleanNode: " + node);

      return visitor.bool((BooleanNode) node);

    case MISSING:
      Preconditions.checkArgument(node instanceof MissingNode,
          "Expected instance of MissingNode: " + node);

      return visitor.missing((MissingNode) node);

    case NULL:
      Preconditions.checkArgument(node instanceof NullNode,
          "Expected instance of NullNode: " + node);

      return visitor.nullNode((NullNode) node);

    default:
      throw new IllegalArgumentException(
          "Unknown node type: " + node.getNodeType() + ": " + node);
  }
}
 
开发者ID:apache,项目名称:parquet-mr,代码行数:73,代码来源:AvroJson.java



注:本文中的com.fasterxml.jackson.databind.node.BinaryNode类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ClosestRayResultCallback类代码示例发布时间:2022-05-23
下一篇:
Java MessageDecoderResult类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap