Vaadin 8 and VaadinSession.getCurrent().setConverterFactory

We are migrating one larger app from Vaddin 7 to Vaadin 8 and it goes great so far. However we have one problem with form binding for situation where model field is double, and it is displayed with TextField. With new binder it fails with error that it can’t convert double to string. Defining custom field binding with converter defined fixes the problem but its not convenient doing this way for each numeric field. Is there a way in Vaadin 8 to set default converters? We used VaadinSession.getCurrent().setConverterFactory( new MyConverterFactory() ); in Vaadin 7 but its deprecated and we cant find any way how to setup this properly in V8.

Hi David,

have you already found a solution for that? We are currently facing the same problem.

No :frowning:

Frustrating. I cannot imagine I have to write

bind(...).withConverter(Integer::valueOf, String::valueOf)...

on each numeric field in all my forms (currently 300+ forms)! It’s good for nice demos on DevDay but totally unusable for real coding. Lack of a global converter factory was one of the reasons to stop our migration.

I just tried Vaadin 8.1.0beta1 and can’t see global converters as well. We should definitely get some update from Vaadin on this. Maybe we are missing something. I can see convertes in package but have no idea how to define them as implicit converters for binder. Also checked binder methods if there is something new for default converters but no luck.

Its rather strange becase its ‘must have’ feature for any form validation. I’m not talking about custom fileds but one have to explicitly specify converter for every TextField with integer, double values etc. which are just very common.

I checked the 8.1 code as well and I do not see any progress. The converters in are here for explicit .withConverter() calls. No code for implicit conversion based on model/presentation types exists and I have no idea where I could hook in.

Looks like we have to stay with Vaadin7 as long as possible and hope the core team will help us. But, API changing every 2 years (FormFactory and ConverterFactory were introduced in Vaadin 7) without any migration path makes me a bit unsure what about Vaadin future.

Hopefully semeone from Vaadin put some light on this …

Our team have not found any solution for this yet. So it would be great if someone from Vaadin could share some ideas how to solve the problem.