PropertySet / Binder / Validator for JsonNode.
Reading / Writing
NumberField number = new NumberField();
JsonBinder binder = new JsonBinder();
binder.forField(number).bind("number");
binder.setBean(objectMapper.readTree("{\"number\" : \"2.0\"}));
Json schema validation
Is using networknt/json-schema-validator.
binder.withValidator(new JsonValidator(
JsonSchemaFactory.builder(
JsonSchemaFactory.getInstance(SpecVersion.VersionFlag.V7))
.build()
.getSchema("{\"required\": [\"number\"]}")
)
);
Label statusLabel = new Label();
binder.setStatusLabel(statusLabel);