public static HtmlField createHtmlField(String htmlValue) { HtmlField field = new HtmlFieldImpl(); field.setHTML(htmlValue); return field; }
/** * Transform the JSON node field into html field POJO. * * @param jsonNode * @param key * @return */ private HtmlField transformHtmlFieldJsonNode(JsonNode jsonNode, String key) { // Unwrap stored pojos if (jsonNode.isPojo()) { HtmlField field = pojoNodeToValue(jsonNode, HtmlField.class, key); if (field == null || field.getHTML() == null) { return null; } else { return field; } } HtmlField htmlField = new HtmlFieldImpl(); if (!jsonNode.isNull() && jsonNode.isTextual()) { htmlField.setHTML(jsonNode.textValue()); } if (!jsonNode.isNull() && !jsonNode.isTextual()) { throw error(BAD_REQUEST, "field_html_error_invalid_type", key, jsonNode.asText()); } return htmlField; }