org.codehaus.jackson.node.JsonNodeFactory.nullNode()方法的使用及代码示例

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

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

JsonNodeFactory.nullNode介绍

[英]Factory method for getting an instance of JSON null node (which represents literal null value)
[中]获取JSON null节点实例(表示文本null值)的工厂方法

代码示例

代码示例来源:origin: org.codehaus.jackson/jackson-mapper-asl

public final NullNode nullNode() { return _nodeFactory.nullNode(); }

代码示例来源:origin: org.codehaus.jackson/jackson-mapper-asl

/**
 * Alternate factory method that will handle wrapper value, which may
 * be null.
 * Due to possibility of null, returning type is not guaranteed to be
 * {@link NumericNode}, but just {@link ValueNode}.
 * 
 * @since 1.9
 */
public ValueNode numberNode(Long value) {
  return (value == null) ? nullNode() : LongNode.valueOf(value.longValue());
}

代码示例来源:origin: org.codehaus.jackson/jackson-mapper-asl

/**
 * Alternate factory method that will handle wrapper value, which may
 * be null.
 * Due to possibility of null, returning type is not guaranteed to be
 * {@link NumericNode}, but just {@link ValueNode}.
 * 
 * @since 1.9
 */
public ValueNode numberNode(Float value) {
  return (value == null) ? nullNode() : DoubleNode.valueOf(value.doubleValue());
}

代码示例来源:origin: org.codehaus.jackson/jackson-mapper-asl

/**
 * Alternate factory method that will handle wrapper value, which may
 * be null.
 * Due to possibility of null, returning type is not guaranteed to be
 * {@link NumericNode}, but just {@link ValueNode}.
 * 
 * @since 1.9
 */
public ValueNode numberNode(Short value) {
  return (value == null) ? nullNode() : IntNode.valueOf(value.shortValue());
}

代码示例来源:origin: org.codehaus.jackson/jackson-mapper-asl

/**
 * Alternate factory method that will handle wrapper value, which may
 * be null.
 * Due to possibility of null, returning type is not guaranteed to be
 * {@link NumericNode}, but just {@link ValueNode}.
 * 
 * @since 1.9
 */
public ValueNode numberNode(Double value) {
  return (value == null) ? nullNode() : DoubleNode.valueOf(value.doubleValue());
}

代码示例来源:origin: org.codehaus.jackson/jackson-mapper-asl

/**
 * Alternate factory method that will handle wrapper value, which may
 * be null.
 * Due to possibility of null, returning type is not guaranteed to be
 * {@link NumericNode}, but just {@link ValueNode}.
 * 
 * @since 1.9
 */
public ValueNode numberNode(Byte value) {
  return (value == null) ? nullNode() : IntNode.valueOf(value.intValue());
}

代码示例来源:origin: org.codehaus.jackson/jackson-mapper-asl

/**
 * Alternate factory method that will handle wrapper value, which may
 * be null.
 * Due to possibility of null, returning type is not guaranteed to be
 * {@link NumericNode}, but just {@link ValueNode}.
 * 
 * @since 1.9
 */
public ValueNode numberNode(Integer value) {
  return (value == null) ? nullNode() : IntNode.valueOf(value.intValue());
}

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

private List<Schema.Field> getFields(Schema.Field schemaField) {
 List<Schema.Field> fields = new ArrayList<Schema.Field>();
 JsonNode nullDefault = JsonNodeFactory.instance.nullNode();
 if (schemaField.schema().getType() == Schema.Type.RECORD) {
  for (Schema.Field field : schemaField.schema().getFields()) {
   fields.add(new Schema.Field(field.name(), field.schema(), field.doc(), nullDefault));
  }
 } else {
  fields.add(new Schema.Field(schemaField.name(), schemaField.schema(), schemaField.doc(),
    nullDefault));
 }
 return fields;
}

代码示例来源:origin: apache/incubator-gobblin

private Schema buildRecordSchema(JsonSchema schema, WorkUnitState workUnit, String name, String namespace) {
 List<Schema.Field> fields = new ArrayList<>();
 for (int i = 0; i < schema.fieldsCount(); i++) {
  JsonSchema map = schema.getFieldSchemaAt(i);
  String childNamespace = buildNamespace(namespace, name);
  JsonElementConverter converter;
  String sourceType;
  Schema fldSchema;
  try {
   sourceType = map.isType(UNION) ? UNION.toString().toLowerCase() : map.getType().toString().toLowerCase();
   converter = getConvertor(map, childNamespace, workUnit);
   this.converters.put(map.getColumnName(), converter);
   fldSchema = converter.schema();
  } catch (UnsupportedDateTypeException e) {
   throw new UnsupportedOperationException(e);
  }
  Schema.Field fld = new Schema.Field(map.getColumnName(), fldSchema, map.getComment(),
    map.isNullable() ? JsonNodeFactory.instance.nullNode() : null);
  fld.addProp(SOURCE_TYPE, sourceType);
  fields.add(fld);
 }
 Schema avroSchema = Schema.createRecord(name.isEmpty() ? null : name, "", namespace, false);
 avroSchema.setFields(fields);
 return avroSchema;
}

代码示例来源:origin: org.codehaus.jackson/jackson-mapper-asl

/**
 * Customized {@link TypeResolverBuilder} that provides type resolver builders
 * used with so-called "default typing"
 * (see {@link ObjectMapper#enableDefaultTyping()} for details).
 *<p>
 * Type resolver construction is based on configuration: implementation takes care
 * of only providing builders in cases where type information should be applied.
 * This is important since build calls may be sent for any and all types, and
 * type information should NOT be applied to all of them.
 */
public static class DefaultTypeResolverBuilder
  extends StdTypeResolverBuilder
{
  /**
   * Definition of what types is this default typer valid for.
   */
  protected final DefaultTyping _appliesFor;
  public DefaultTypeResolverBuilder(DefaultTyping t) {
    _appliesFor = t;
  }
  @Override
  public TypeDeserializer buildTypeDeserializer(DeserializationConfig config,
      JavaType baseType, Collection<NamedType> subtypes, BeanProperty property)
  {
    return useForType(baseType) ? super.buildTypeDeserializer(config, baseType, subtypes, property) : null;
  }
  @Override

代码示例来源:origin: camunda/camunda-bpm-platform

public final NullNode nullNode() { return _nodeFactory.nullNode(); }

代码示例来源:origin: org.codehaus.jackson/jackson-mapper-asl

return nodeFactory.nullNode();
return nodeFactory.nullNode();

代码示例来源:origin: camunda/camunda-bpm-platform

/**
 * Alternate factory method that will handle wrapper value, which may
 * be null.
 * Due to possibility of null, returning type is not guaranteed to be
 * {@link NumericNode}, but just {@link ValueNode}.
 * 
 * @since 1.9
 */
public ValueNode numberNode(Short value) {
  return (value == null) ? nullNode() : IntNode.valueOf(value.shortValue());
}

代码示例来源:origin: camunda/camunda-bpm-platform

/**
 * Alternate factory method that will handle wrapper value, which may
 * be null.
 * Due to possibility of null, returning type is not guaranteed to be
 * {@link NumericNode}, but just {@link ValueNode}.
 * 
 * @since 1.9
 */
public ValueNode numberNode(Double value) {
  return (value == null) ? nullNode() : DoubleNode.valueOf(value.doubleValue());
}

代码示例来源:origin: camunda/camunda-bpm-platform

/**
 * Alternate factory method that will handle wrapper value, which may
 * be null.
 * Due to possibility of null, returning type is not guaranteed to be
 * {@link NumericNode}, but just {@link ValueNode}.
 * 
 * @since 1.9
 */
public ValueNode numberNode(Long value) {
  return (value == null) ? nullNode() : LongNode.valueOf(value.longValue());
}

代码示例来源:origin: camunda/camunda-bpm-platform

/**
 * Alternate factory method that will handle wrapper value, which may
 * be null.
 * Due to possibility of null, returning type is not guaranteed to be
 * {@link NumericNode}, but just {@link ValueNode}.
 * 
 * @since 1.9
 */
public ValueNode numberNode(Byte value) {
  return (value == null) ? nullNode() : IntNode.valueOf(value.intValue());
}

代码示例来源:origin: camunda/camunda-bpm-platform

/**
 * Alternate factory method that will handle wrapper value, which may
 * be null.
 * Due to possibility of null, returning type is not guaranteed to be
 * {@link NumericNode}, but just {@link ValueNode}.
 * 
 * @since 1.9
 */
public ValueNode numberNode(Integer value) {
  return (value == null) ? nullNode() : IntNode.valueOf(value.intValue());
}

代码示例来源:origin: camunda/camunda-bpm-platform

/**
 * Alternate factory method that will handle wrapper value, which may
 * be null.
 * Due to possibility of null, returning type is not guaranteed to be
 * {@link NumericNode}, but just {@link ValueNode}.
 * 
 * @since 1.9
 */
public ValueNode numberNode(Float value) {
  return (value == null) ? nullNode() : DoubleNode.valueOf(value.doubleValue());
}

代码示例来源:origin: camunda/camunda-bpm-platform

/**
 * Customized {@link TypeResolverBuilder} that provides type resolver builders
 * used with so-called "default typing"
 * (see {@link ObjectMapper#enableDefaultTyping()} for details).
 *<p>
 * Type resolver construction is based on configuration: implementation takes care
 * of only providing builders in cases where type information should be applied.
 * This is important since build calls may be sent for any and all types, and
 * type information should NOT be applied to all of them.
 */
public static class DefaultTypeResolverBuilder
  extends StdTypeResolverBuilder
{
  /**
   * Definition of what types is this default typer valid for.
   */
  protected final DefaultTyping _appliesFor;
  public DefaultTypeResolverBuilder(DefaultTyping t) {
    _appliesFor = t;
  }
  @Override
  public TypeDeserializer buildTypeDeserializer(DeserializationConfig config,
      JavaType baseType, Collection<NamedType> subtypes, BeanProperty property)
  {
    return useForType(baseType) ? super.buildTypeDeserializer(config, baseType, subtypes, property) : null;
  }
  @Override

代码示例来源:origin: camunda/camunda-bpm-platform

return nodeFactory.nullNode();
return nodeFactory.nullNode();

相关文章