Automatically create and bind textfields to bean

Hello All,

I’m having a little trouble working out the best way to displaying each field of a bean as a textfield and automatically selecting the converter based on the field type.

I have about 6 different subclasses to display and there are a few fields with types unique to the subclass so I’m trying to avoid explictily declearing the binding and converter.

for example I’m trying to do something like,

Binder binder = new Binder<>(SubClass.class);
foreach( Property property: sublcass){
tf = new TextField(“property”);
binder.bind(tf, property);

Thanks for you help


I ended up adding a getbinder method to each of my subclasses to return a binder of the subclass type.
And I added a lookup based on the current field type to get the required converter.

But I’d still appreciate hearing people thoughts on creating a form automatically given a bean.