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 ); } }
@Activate public void activate() { Serializer serializer = Serializer.using(KryoNamespaces.API, ObjectNode.class, ArrayNode.class, JsonNodeFactory.class, LinkedHashMap.class, TextNode.class, BooleanNode.class, LongNode.class, DoubleNode.class, ShortNode.class, IntNode.class, NullNode.class); prefsConsistentMap = storageService.<String, ObjectNode>consistentMapBuilder() .withName(ONOS_USER_PREFERENCES) .withSerializer(serializer) .withRelaxedReadConsistency() .build(); prefsConsistentMap.addListener(prefsListener); prefs = prefsConsistentMap.asJavaMap(); register(core); log.info("Started"); }
@Activate public void activate() { KryoNamespace.Builder kryoBuilder = new KryoNamespace.Builder() .register(KryoNamespaces.API) .register(ConfigKey.class, ObjectNode.class, ArrayNode.class, JsonNodeFactory.class, LinkedHashMap.class, TextNode.class, BooleanNode.class, LongNode.class, DoubleNode.class, ShortNode.class, IntNode.class, NullNode.class); configs = storageService.<ConfigKey, JsonNode>consistentMapBuilder() .withSerializer(Serializer.using(kryoBuilder.build())) .withName("onos-network-configs") .withRelaxedReadConsistency() .build(); configs.addListener(listener); log.info("Started"); }
@Test public void deserializePrimitiveTest() { assertEquals(Boolean.TRUE, Deserializer.fromJson(TypeNode.fromString("bool"), BooleanNode.TRUE)); assertEquals(Boolean.FALSE, Deserializer.fromJson(TypeNode.fromString("bool"), BooleanNode.FALSE)); assertEquals('a', Deserializer.fromJson(TypeNode.fromString("char"), TextNode.valueOf("a"))); assertEquals(Integer.valueOf(123), Deserializer.fromJson(TypeNode.fromString("int"), IntNode.valueOf(123))); assertEquals(Long.valueOf(123), Deserializer.fromJson(TypeNode.fromString("long"), IntNode.valueOf(123))); assertEquals(Double.valueOf(123.0), Deserializer.fromJson(TypeNode.fromString("double"), DoubleNode.valueOf(123.0))); assertEquals("algohub", Deserializer.fromJson(TypeNode.fromString("string"), TextNode.valueOf("algohub"))); }
@Test public void primitiveToJsonTest() { assertEquals(BooleanNode.TRUE, Serializer.toJson(true, TypeNode.fromString("bool"))); assertEquals(BooleanNode.FALSE, Serializer.toJson(false, TypeNode.fromString("bool"))); assertEquals(TextNode.valueOf("a"), Serializer.toJson('a', TypeNode.fromString("char"))); assertEquals(IntNode.valueOf(123), Serializer.toJson(123, TypeNode.fromString("int"))); assertEquals(LongNode.valueOf(123), Serializer.toJson(123L, TypeNode.fromString("long"))); assertEquals(DoubleNode.valueOf(123.0), Serializer.toJson(123.0, TypeNode.fromString("double"))); assertEquals(TextNode.valueOf("123"), Serializer.toJson("123", TypeNode.fromString("string"))); }
@Deprecated public static ValueNode toValueNode(Object value) { if (value == null) return NullNode.instance; if (value instanceof ValueNode) return (ValueNode) value; if (value instanceof Boolean) return BooleanNode.valueOf((boolean) value); else if (value instanceof Integer) return IntNode.valueOf((int) value); else if (value instanceof Long) return LongNode.valueOf((long) value); else if (value instanceof Double) return DoubleNode.valueOf((double) value); else if (value instanceof Float) return FloatNode.valueOf((float) value); return TextNode.valueOf(value.toString()); }
public static ValueNode toValueNode(Object value) { if (value == null) return NullNode.instance; if (value instanceof ValueNode) return (ValueNode) value; if (value instanceof Boolean) return BooleanNode.valueOf((boolean) value); else if (value instanceof Integer) return IntNode.valueOf((int) value); else if (value instanceof Long) return LongNode.valueOf((long) value); else if (value instanceof Double) return DoubleNode.valueOf((double) value); else if (value instanceof Float) return FloatNode.valueOf((float) value); return TextNode.valueOf(value.toString()); }
/** * Get an Avro schema using {@link AvroUtils#wrapAsNullable(Schema)} by node type. * * @param node Json node. * @return an Avro schema using {@link AvroUtils#wrapAsNullable(Schema)} by node type. */ public Schema getAvroSchema(JsonNode node) { if (node instanceof TextNode) { return AvroUtils.wrapAsNullable(AvroUtils._string()); } else if (node instanceof IntNode) { return AvroUtils.wrapAsNullable(AvroUtils._int()); } else if (node instanceof LongNode) { return AvroUtils.wrapAsNullable(AvroUtils._long()); } else if (node instanceof DoubleNode) { return AvroUtils.wrapAsNullable(AvroUtils._double()); } else if (node instanceof BooleanNode) { return AvroUtils.wrapAsNullable(AvroUtils._boolean()); } else if (node instanceof NullNode) { return AvroUtils.wrapAsNullable(AvroUtils._string()); } else { return Schema.createRecord(getSubRecordRandomName(), null, null, false, getFields(node)); } }
@Override public JsonNode evaluate(JsonNode node) { JsonNode valueNode = super.evaluate(node); if(valueNode!=null && valueNode.isNumber()) { return DoubleNode.valueOf(Math.ceil(valueNode.asDouble())); } else if (valueNode!=null && valueNode.isTextual()){ try { Double doubleVal = Double.parseDouble(valueNode.asText()); return DoubleNode.valueOf(Math.ceil(doubleVal)); } catch(NumberFormatException e) { throw new UnsupportedExprException("Value not parseable to a number"); } } else { throw new UnsupportedExprException("Value not a number or text to parse to a number"); } }
@Override public JsonNode evaluate(JsonNode node) { JsonNode valueNode = super.evaluate(node); if(valueNode!=null && valueNode.isNumber()) { return DoubleNode.valueOf(Math.floor(valueNode.asDouble())); } else if (valueNode!=null && valueNode.isTextual()){ try { Double doubleVal = Double.parseDouble(valueNode.asText()); return DoubleNode.valueOf(Math.floor(doubleVal)); } catch(NumberFormatException e) { throw new UnsupportedExprException("Value not parseable to a number"); } } else { throw new UnsupportedExprException("Value not a number or text to parse to a number"); } }
public Geocoder.LatLong geocode(String address) { try { Map<String, Object> vars = new HashMap<>(); vars.put("address", address); ResponseEntity<JsonNode> jsonNodeResponseEntity = this.restTemplate.getForEntity( this.urlPath, JsonNode.class, vars); JsonNode body = jsonNodeResponseEntity.getBody(); if (jsonNodeResponseEntity.getStatusCode().equals(HttpStatus.OK) && body.path("status").textValue().equalsIgnoreCase("OK")) { if (body.path("results").size() > 0) { String formattedAddress = body.path("results").get(0).get("formatted_address").textValue(); DoubleNode lngNode = (DoubleNode) body.path("results").get(0).path("geometry").path("location").get("lng"); DoubleNode latNode = (DoubleNode) body.path("results").get(0).path("geometry").path("location").get("lat"); log.debug(String.format("formatted address: %s", formattedAddress)); return new Geocoder.LatLong(latNode.doubleValue(), lngNode.doubleValue()); } } } catch (Exception ex) { log.debug("exception when processing address '" + address + "'", ex); } return null; }
@Override public void setProp(HasProp hasProp, String group, String key, Object value) { try { ObjectNode groupJSON = getOrCreateJsonGroup(hasProp, group); if (value == null) { groupJSON.put(key, NullNode.getInstance()); } else if (value instanceof Long) { groupJSON.put(key, LongNode.valueOf((Long) value)); } else if (value instanceof Double) { groupJSON.put(key, DoubleNode.valueOf((Double) value)); } else if (value instanceof Integer) { groupJSON.put(key, IntNode.valueOf((Integer) value)); } else if (value instanceof Float) { groupJSON.put(key, new DoubleNode((double) value)); } else if (value instanceof String) { groupJSON.put(key, TextNode.valueOf((String) value)); } else if (value instanceof Boolean) { groupJSON.put(key, BooleanNode.valueOf((Boolean) value)); } hasProp.setPropsJson(group, groupJSON.toString()); } catch (Exception e) { logSetProp(hasProp, group, key, value); } }
public void incrementProperty(Connection conn, String project, Object userId, String property, double value) throws SQLException { Map<String, FieldType> columns = createMissingColumns(project, userId, ImmutableList.of(new SimpleImmutableEntry<>(property, new DoubleNode(value))), new CommitConnection(conn)); FieldType fieldType = columns.get(property); if (fieldType == null) { createColumn(project, userId, property, JsonHelper.numberNode(0)); } if (!fieldType.isNumeric()) { throw new RakamException(String.format("The property the is %s and it can't be incremented.", fieldType.name()), BAD_REQUEST); } String tableRef = checkTableColumn(stripName(property, "table column")); Statement statement = conn.createStatement(); ProjectCollection userTable = getUserTable(project, false); String table = checkProject(userTable.project, '"') + "." + checkCollection(userTable.collection); int execute = statement.executeUpdate("update " + table + " set " + tableRef + " = " + value + " + coalesce(" + tableRef + ", 0)"); if (execute == 0) { create(project, userId, JsonHelper.jsonObject().put(property, value)); } }
public boolean arrayNodesHaveSameValues(JsonNode expected, JsonNode actual) { int i = 0; for (Iterator<JsonNode> nodes = expected.elements(); nodes.hasNext(); i++) { JsonNode node = nodes.next(); if (node instanceof TextNode) { return textNodesHaveSameValue(node, actual.get(i)); } else if (node instanceof IntNode) { return intNodesHaveSameValue(node, actual.get(i)); } else if (node instanceof DoubleNode) { return doubleNodesHaveSameValue(node, actual.get(i)); } } return true; }
@SuppressWarnings("UnusedDeclaration") public void setPrecision(final JsonNode value) throws IOException { if (value.isObject()) { sd = new FieldSampler() { FieldSampler base = FieldSampler.newSampler(value.toString()); @Override public JsonNode sample() { return new DoubleNode(Math.sqrt(1 / base.sample().asDouble())); } }; } else { this.sd = constant(Math.sqrt(1 / value.asDouble())); } init(); }
@SuppressWarnings("UnusedDeclaration") public void setVariance(final JsonNode value) throws IOException { if (value.isObject()) { sd = new FieldSampler() { FieldSampler base = FieldSampler.newSampler(value.toString()); @Override public JsonNode sample() { return new DoubleNode(Math.sqrt(base.sample().asDouble())); } }; } else { this.sd = constant(Math.sqrt(value.asDouble())); } init(); }
@SuppressWarnings("UnusedDeclaration") public void setSD(final JsonNode value) throws IOException { if (value.isObject()) { sd = new FieldSampler() { FieldSampler base = FieldSampler.newSampler(value.toString()); @Override public JsonNode sample() { return new DoubleNode(base.sample().asDouble()); } }; } else { sd = constant(value.asDouble()); } init(); }
@Test public void unionDoubleInFloatRangeMax() throws JsonProcessingException, IOException { Schema schemaA = SchemaBuilder.builder().floatType(); Schema schemaB = SchemaBuilder.builder().intType(); Schema schema = SchemaBuilder.unionOf().type(schemaA).and().type(schemaB).endUnion(); JsonNode datum = new DoubleNode(Float.MAX_VALUE); UnionResolution unionResolution = new JasvornoConverter(model, UndeclaredFieldBehaviour.NO_MATCH) .resolveUnion(datum, schema.getTypes()); assertThat(unionResolution.matchType, is(MatchType.FULL)); assertThat(unionResolution.schema, is(schemaA)); }
@Test public void unionDoubleInFloatRangeMin() throws JsonProcessingException, IOException { Schema schemaA = SchemaBuilder.builder().floatType(); Schema schemaB = SchemaBuilder.builder().intType(); Schema schema = SchemaBuilder.unionOf().type(schemaA).and().type(schemaB).endUnion(); JsonNode datum = new DoubleNode(-Float.MAX_VALUE); UnionResolution unionResolution = new JasvornoConverter(model, UndeclaredFieldBehaviour.NO_MATCH) .resolveUnion(datum, schema.getTypes()); assertThat(unionResolution.matchType, is(MatchType.FULL)); assertThat(unionResolution.schema, is(schemaA)); }
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() ); } }
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() ); } }
@Test public void deserializesDataPoint() throws IOException { final JsonNode jsonNode = mock(JsonNode.class); given(objectCodec.readTree(same(jsonParser))).willReturn(jsonNode); given(jsonNode.get(0)).willReturn(LongNode.valueOf(123L)); given(jsonNode.get(1)).willReturn(DoubleNode.valueOf(234D)); given(jsonNode.get(2)).willReturn(IntNode.valueOf(5)); final QueryResponse.Tag.Result.DataPoint dataPoint = new QueryResponse.Tag.Result.DataPointDeserializer().deserialize(jsonParser, null); assertThat(dataPoint.getTimestamp().getTime(), is(123L)); assertThat(dataPoint.getMeasure(), is(234D)); assertThat(dataPoint.getQuality(), is(5)); }
private JsonNode createNode(Object value) { if (value instanceof Float) { return new FloatNode((Float) value); } else if (value instanceof Double) { return new DoubleNode((Double) value); } return null; }
/** * Serialize primtive values to JSON . */ static <T> JsonNode primitiveToJson(final T value, final TypeNode type) { final JsonNode result; // for BinaryTreeNode if (value == null) { return NullNode.instance; } switch (type.getValue()) { case BOOL: result = BooleanNode.valueOf((Boolean) value); break; case CHAR: result = TextNode.valueOf(value.toString()); break; case STRING: result = TextNode.valueOf((String) value); break; case DOUBLE: result = DoubleNode.valueOf((Double) value); break; case INT: result = IntNode.valueOf((Integer) value); break; case LONG: result = LongNode.valueOf((Long) value); break; default: throw new IllegalArgumentException("Unrecognized primitive type: " + type); } return result; }
/** * Get value from Json Node. * * @param node * @return value from Json Node */ private Object getValue(JsonNode node) { if (node instanceof TextNode) { return node.textValue(); } else if (node instanceof IntNode) { return node.intValue(); } else if (node instanceof LongNode) { return node.longValue(); } else if (node instanceof DoubleNode) { return node.doubleValue(); } else if (node instanceof BooleanNode) { return node.booleanValue(); } return null; }
/** * Safely serialize a value. * * @since 1.11.2 * @param encoder The <code>StenoEncoder</code> instance. * @param value The <code>Object</code> instance to safely serialize. */ public static void safeEncodeValue(final StringBuilder encoder, @Nullable final Object value) { if (value == null) { encoder.append("null"); } else if (value instanceof Map) { safeEncodeMap(encoder, (Map<?, ?>) value); } else if (value instanceof List) { safeEncodeList(encoder, (List<?>) value); } else if (value.getClass().isArray()) { safeEncodeArray(encoder, value); } else if (value instanceof LogValueMapFactory.LogValueMap) { safeEncodeLogValueMap(encoder, (LogValueMapFactory.LogValueMap) value); } else if (value instanceof Throwable) { safeEncodeThrowable(encoder, (Throwable) value); } else if (StenoSerializationHelper.isSimpleType(value)) { if (value instanceof Boolean) { encoder.append(BooleanNode.valueOf((Boolean) value).toString()); } else if (value instanceof Double) { encoder.append(DoubleNode.valueOf((Double) value).toString()); } else if (value instanceof Float) { encoder.append(FloatNode.valueOf((Float) value).toString()); } else if (value instanceof Long) { encoder.append(LongNode.valueOf((Long) value).toString()); } else if (value instanceof Integer) { encoder.append(IntNode.valueOf((Integer) value).toString()); } else { encoder.append(new TextNode(value.toString()).toString()); } } else { safeEncodeValue(encoder, LogReferenceOnly.of(value).toLogValue()); } }
/** * Add datapoint of double type value. * * @param time datapoint's timestamp * @param value datapoint's value * @return Datapoint */ public Datapoint addDoubleValue(long time, double value) { initialValues(); checkType(TsdbConstants.TYPE_DOUBLE); values.add(Lists.<JsonNode> newArrayList(new LongNode(time), new DoubleNode(value))); return this; }
@Override public void setProp(HasProp o, String group, String key, Double value) { try { ObjectNode groupJSON = getOrCreateJsonGroup(o, group); if (value == null) { groupJSON.put(key, NullNode.getInstance()); } else { groupJSON.put(key, DoubleNode.valueOf(value)); } o.setPropsJson(group, groupJSON.toString()); } catch (Exception e) { logSetProp(o, group, key, value); } }
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; }
@Activate public void activate() { Serializer serializer = Serializer.using(KryoNamespaces.API, ObjectNode.class, ArrayNode.class, JsonNodeFactory.class, LinkedHashMap.class, TextNode.class, BooleanNode.class, LongNode.class, DoubleNode.class, ShortNode.class, IntNode.class, NullNode.class, UiSessionToken.class); prefsConsistentMap = storageService.<String, ObjectNode>consistentMapBuilder() .withName(ONOS_USER_PREFERENCES) .withSerializer(serializer) .withRelaxedReadConsistency() .build(); prefsConsistentMap.addListener(prefsListener); prefs = prefsConsistentMap.asJavaMap(); tokensConsistentMap = storageService.<UiSessionToken, String>consistentMapBuilder() .withName(ONOS_SESSION_TOKENS) .withSerializer(serializer) .withRelaxedReadConsistency() .build(); tokens = tokensConsistentMap.asJavaMap(); register(core); log.info("Started"); }
@Override public JsonNode sample() { double step = rand.nextGaussian() * sd.sample().asDouble() + mean.sample().asDouble(); double newState = state.addAndGet(step); if (verbose) { ObjectNode r = new ObjectNode(JsonNodeFactory.withExactBigDecimals(false)); r.set("value", new DoubleNode(newState)); r.set("step", new DoubleNode(step)); return r; } else { return new DoubleNode(newState); } }
public static FieldSampler constant(final double v) { return new FieldSampler() { private DoubleNode sd = new DoubleNode(v); @Override public JsonNode sample() { return sd; } }; }
@SuppressWarnings("unused") public void setWork(JsonNode value) throws IOException { if (value.isObject()) { workSampler = new FieldSampler() { FieldSampler base = FieldSampler.newSampler(value.toString()); @Override public JsonNode sample() { return new DoubleNode(Math.sqrt(1 / base.sample().asDouble())); } }; } else if (value.isNumber()) { workSampler = constant(value.asDouble()); } }
public void set(double value) { this.node = new DoubleNode(value); }
private JsonNode json(double value) { return new DoubleNode(value); }
private DoubleNode decodeDouble() { return new DoubleNode(this.threadBuffer.get().getDouble()); }
public JsonBuilder put(final String key, final double value) { fields.put(key, new DoubleNode(value)); return this; }
private JsonNode generateValue(LinkedList<String> path, ObjectNode schema, int index) { String stringPath = Utils.join(".", path.toArray(new String[path.size()])); List<Object> list = paths.get(stringPath); if (list != null) return Json7.toNode(list.get(random.nextInt(list.size()))); JsonNode values = Json7.get(schema, "_values"); if (values != null) { if (values.isArray()) { if (index < values.size()) return values.get(index); return values.get(random.nextInt(values.size())); } else return values; } JsonNode enumType = Json7.get(schema, "_enumType"); if (enumType != null) { if (types.containsKey(enumType.asText())) { List<String> typeValues = types.get(enumType.asText()); String value = typeValues.get(random.nextInt(typeValues.size())); return Json7.toNode(value); } } JsonNode examples = Json7.get(schema, "_examples"); if (examples != null) { if (examples.isArray()) { if (index < examples.size()) return examples.get(index); return examples.get(random.nextInt(examples.size())); } else return examples; } String type = schema.get("_type").asText(); if ("text".equals(type)) return TextNode.valueOf( "But I must explain to you how all this mistaken idea of denouncing pleasure and praising pain was born and I will give you a complete account of the system, and expound the actual teachings of the great explorer of the truth, the master-builder of human happiness."); else if ("string".equals(type)) return TextNode.valueOf("RD5654GH78"); else if ("boolean".equals(type)) return BooleanNode.valueOf(random.nextBoolean()); else if ("integer".equals(type)) return IntNode.valueOf(random.nextInt()); else if ("long".equals(type)) return LongNode.valueOf(random.nextLong()); else if ("float".equals(type)) return FloatNode.valueOf(random.nextFloat()); else if ("double".equals(type)) return DoubleNode.valueOf(random.nextDouble()); else if ("date".equals(type)) return TextNode.valueOf("2015-09-09"); else if ("time".equals(type)) return TextNode.valueOf("15:30:00"); else if ("timestamp".equals(type)) return TextNode.valueOf("2015-01-09T15:37:00.123Z"); else if ("enum".equals(type)) return TextNode.valueOf("blue"); else if ("geopoint".equals(type)) return Json7.object("lat", 48 + random.nextDouble(), "lon", 2 + random.nextDouble()); else if ("object".equals(type)) return generateObject(path, schema, index); return NullNode.getInstance(); }
public static GtExpression gt(String property, Double value) { return new GtExpression(val(property), DoubleNode.valueOf(value)); }