public static void addTypedNode(ObjectNode node, String key, Object value) throws LeanException { if (value instanceof List) { List list = (List) value; ArrayNode arrayNode = JsonUtils.getObjectMapper().createArrayNode(); for (Object listItem : list) { addTypedValueToArray(arrayNode, listItem); } node.put(key, arrayNode); } else { addTypedValue(node, key, value); } }
private static ObjectNode getTextNode(Text text) { ObjectNode dateNode = JsonUtils.getObjectMapper().createObjectNode(); dateNode.put("type", "text"); dateNode.put("value", text.getValue()); return dateNode; }
private static ObjectNode getDateNode(Date date) { ObjectNode dateNode = JsonUtils.getObjectMapper().createObjectNode(); dateNode.put("type", "date"); dateNode.put("value", date.getTime()); return dateNode; }