Usually when the form auto-filling is done, the resulted data from the input fields is being validated and persisted to a database.
Form Filler add-on could make this process more automatic with less boilerplate code, having the Binder as an input and giving a bean as output.
The user case is the following:
Input a raw content as a text or image
Click a button, start the form filling
Check for input fields validation errors
Check for recommendations from application about fields where form filler couldn't populate data
Do manual corrections or type in the values manually where needed
Click on "Save" button
Redo 3-6 step until validation passes.
Step 3 can be done automatically by Form Filler and for step 4 you could have an API in Form Filler that gives you a list of recommendations mapped to the input fields ID/names/labels, so that these recommendations can be placed to the UI.
Suppose you have an entity class:
public class Entity implements Serializable {
String name;
String address;
}
and Binder object:
Binder<Entity> binder = new Binder<>(Entity.class);
binder.bind(nameField, Entity::getName, Entity::setName);
binder.bind(addressField, Entity::getAddress, Entity::setAddress);
binder.withValidator(entity -> /* any validation logic*/,
"Name must contain ...");
you should be able to set it to Form Filler:
FormFiller formFiller = new FormFiller(formLayout);
formFiller.setBinder(binder);
FormFillerResult result = formFiller.fill(inputText);
If the binder is specified, form filler should make a validation and prepare a bean if it's valid or give recommendations:
Usually when the form auto-filling is done, the resulted data from the input fields is being validated and persisted to a database. Form Filler add-on could make this process more automatic with less boilerplate code, having the Binder as an input and giving a bean as output. The user case is the following:
Step 3 can be done automatically by Form Filler and for step 4 you could have an API in Form Filler that gives you a list of recommendations mapped to the input fields ID/names/labels, so that these recommendations can be placed to the UI.
Suppose you have an entity class:
and Binder object:
you should be able to set it to Form Filler:
If the binder is specified, form filler should make a validation and prepare a bean if it's valid or give recommendations:
Bean validation errors can be handled with Binder directly. For the further validations (points 6-7) the Binder should be used directly.