Java 类org.codehaus.jackson.node.DoubleNode 实例源码

项目:NoSQLDataEngineering    文件:RawSchemaGen.java   
public static SchemaComponent deSchema(String name, JsonNode n)
{
    if (n.isObject())
        return deSchema(name, (ObjectNode)n);

    if (n.isArray())
        return deSchema(name, (ArrayNode)n);

    if (n.isBoolean())
        return deSchema(name, (BooleanNode)n);

    if(n.isInt())
        return deSchema(name, (IntNode)n);      

    if (n.isFloatingPointNumber())
        return deSchema(name, (DoubleNode)n);

    if (n.isNull())
        return deSchema(name, (NullNode)n);

    return null;
}
项目:datacollector    文件:AvroSchemaGenerator.java   
private JsonNode convertToJsonNode(AvroDefaultConfig defaultConfig) {
  switch (defaultConfig.avroType) {
    case BOOLEAN:
      return Boolean.parseBoolean(defaultConfig.defaultValue) ? BooleanNode.TRUE : BooleanNode.FALSE;
    case INTEGER:
      return new IntNode(Integer.parseInt(defaultConfig.defaultValue));
    case LONG:
      return new LongNode(Long.parseLong(defaultConfig.defaultValue));
    case FLOAT:
      // FloatNode is fairly recent and our Jackson version does not have it yet
      return new DoubleNode(Float.parseFloat(defaultConfig.defaultValue));
    case DOUBLE:
      return new DoubleNode(Double.parseDouble(defaultConfig.defaultValue));
    case STRING:
      return new TextNode(defaultConfig.defaultValue);
    default:
      throw new IllegalArgumentException("Unknown type: " + defaultConfig.avroType);
  }
}
项目:secure-data-service    文件:GenericEntityDeserializer.java   
private Object processPrimitive(final JsonNode prim) {
    Object val;

    if (prim instanceof BooleanNode) {
        val = prim.getBooleanValue();
    } else if (prim instanceof DoubleNode) {
        val = prim.getDoubleValue();
    } else if (prim instanceof IntNode) {
        val = prim.getIntValue();
    } else if (prim instanceof LongNode) {
        val = prim.getLongValue();
    } else {
        val = prim.getTextValue();
    }
    return val;
}
项目:NoSQLDataEngineering    文件:RawSchemaGen.java   
private static SchemaComponent deSchema(String name, DoubleNode i)
{
    NumberSC schema  = new NumberSC();
    return schema;
}