dooApp/FXForm2

How to get rid of the "No adapter between types ... found" warnings?

Closed this issue · 2 comments

xylo commented

I'm using buffered FXForms. They work fine but I get a lot of warnings on the console, e.g.:

Aug 04, 2017 1:37:53 PM com.dooapp.fxform.adapter.DefaultAdapterProvider getAdapter
WARNUNG: No adapter between types class javafx.beans.property.adapter.JavaBeanObjectProperty and class com.dooapp.fxform.view.property.ChoiceBoxDefaultProperty was found (to adapt com.dooapp.fxform.model.impl.BufferedPropertyElement@5a25dae0 and com.dooapp.fxform.view.factory.impl.EnumChoiceBoxFactory$1@31359f9a)
Make sure to register the required adapter in DefaultAdapterProvider either in the global or in the user map. See FXForm#setAdapterProvider

Do I have to worry about this warning?
Is there a way to deactivate it?

This message is logged when no explicit Adapter (used to adapt values between the model and view properties) could be retrieved from the adapters registered in the DefaultAdapterProvider. In this case the DefaultAdapterProvider returns a DefaultAdapter (which does no adaptation) which might work in some cases but we can not be sure of it, that's why this message is displayed.

In your specific case (a classic java bean value on the model side and a ChoiceBoxDefaultProperty on the view side) the DefaultAdapter should work, so you can get ride of this message by explicitly registering the DefaultAdapter for this case :

DefaultAdapterProvider.addGlobalAdapter((fromClass, toClass, element, fxFormNode) -> JavaBeanObjectProperty.class.equals(fromClass) && ChoiceBoxDefaultProperty.class.equals(toClass), new DefaultAdapter());
xylo commented

Thanks for the tip! It works.