How to prevent show text "null"
when using Binder
withConverter
method
TextField id = new TextField("Id");
TextField name = new TextField("Name");
Binder<Customer> b = new Binder<>();
b.forField(id)
.withConverter(Integer::valueOf, String::valueOf, "Invalid")
.bind(Customer::getId, Customer::setId);
b.forField(name)
.bind(Customer::getName, Customer::setName);
b.readBean(customer);
And the result is it:
How do the conversion without losing the validation type?