Null fields with need for a converter always fail in Binder#bindInstanceFields


Binder#bindInstanceFields always fails if a field that requires a converter is null (it is null or non null based on the model state).

Default behaviour is to fail if model vs field type are different.
It is not possible to override it by binding the field manually, because it is null.

We tested on Vaadin8, but the code seems to be similar in 23.

It would be nice to have possibility to add ignored field names to binder.
Or at least have getFieldsInDeclareOder protected and create own Binder that would implement this.

We also would like to have getBoundProperties() available as public. We have a dynamic framework built on Vaadin 7 and these features seem to miss in Vaadin 8+.


public void bindInstanceFields(Object objectWithMemberFields) {
    Class<?> objectClass = objectWithMemberFields.getClass();

    Integer numberOfBoundFields = getFieldsInDeclareOrder(objectClass)
        .filter(memberField -> !ignoredFieldNames.contains(memberField.getName())) // added line


This seems not to be practical the logic to add/not add a field can be complex and buried deeply in code. So it would be also complex to call .binder.ignoreField() correctly.

It woudl be better to have binder.bindInstanceFields customizable, different, more tolerant.

It fails now on trying to instantiate a field that has no parameterless constructor and no easy way to setup…

If you need full flexibility, bindInstanceFields() is not the normal use case. You can also call binder.forField() to create fully dynamic views instead of relying on fields.

Well it worked in V7 and we look for a solution in V8 without rewriting everything. Also, you cannot call forField on a null field as I described.

Data Binding had a major refactoring from V7->V8. I don’t think you have much look without a good refactoring on your side. If you need additional features in the binder, the GitHub repository of flow would be a good starting point to create an enhancement ticket about it.

Yes, I know that.

E.g. by adding options: bindEqualTypesOnly, bindNullFields

I recommend creating a GitHub issue about it: Sign in to GitHub · GitHub