@Test public void constructStruct() { assertEquals( new ExprTupleValue( new LinkedHashMap<String, ExprValue>() { { put("id", integerValue(1)); put("state", stringValue("WA")); } }), tupleValue("{\"structV\":{\"id\":1,\"state\":\"WA\"}}").get("structV")); }
private ExprTupleValue constructStruct(JsonNode value, String path) { LinkedHashMap<String, ExprValue> map = new LinkedHashMap<>(); value .fieldNames() .forEachRemaining( field -> map.put(field, construct(makeField(path, field), value.get(field)))); return new ExprTupleValue(map); }
ElasticsearchExprValueFactory { private ExprTupleValue constructStruct(JsonNode value, String path) { LinkedHashMap<String, ExprValue> map = new LinkedHashMap<>(); value .fieldNames() .forEachRemaining( field -> map.put(field, construct(makeField(path, field), value.get(field)))); return new ExprTupleValue(map); } }
ElasticsearchExprValueFactory { private ExprTupleValue constructStruct(JsonNode value, String path) { LinkedHashMap<String, ExprValue> map = new LinkedHashMap<>(); value .fieldNames() .forEachRemaining( field -> map.put(field, construct(makeField(path, field), value.get(field)))); return new ExprTupleValue(map); }  }
ElasticsearchExprValueFactory { private ExprTupleValue constructStruct(JsonNode value, String path) { LinkedHashMap<String, ExprValue> map = new LinkedHashMap<>(); value .fieldNames() .forEachRemaining( field -> map.put(field, construct(makeField(path, field), value.get(field)))); return new ExprTupleValue(map); }  ExprTupleValue construct(String jsonString); ExprValue construct(String field, Object value); }
ElasticsearchExprValueFactory { private ExprTupleValue constructStruct(JsonNode value, String path) { LinkedHashMap<String, ExprValue> map = new LinkedHashMap<>(); value .fieldNames() .forEachRemaining( field -> map.put(field, construct(makeField(path, field), value.get(field)))); return new ExprTupleValue(map); }  ExprTupleValue construct(String jsonString); ExprValue construct(String field, Object value);  }