Skip to content

Latest commit

 

History

History
executable file
·
35 lines (28 loc) · 947 Bytes

README.adoc

File metadata and controls

executable file
·
35 lines (28 loc) · 947 Bytes

Json binding

PropertySet / Binder / Validator for JsonNode.

Usages

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

binder.withValidator(new JsonValidator(
        JsonSchemaFactory.builder(
                JsonSchemaFactory.getInstance(SpecVersion.VersionFlag.V7))
                .build()
                .getSchema("{\"required\": [\"number\"]}")
        )
);
Label statusLabel = new Label();
binder.setStatusLabel(statusLabel);
demo

Source code