Hi,
I'd like to propose a change to our DataBinding integration in Errai
UI. Basically, I think we should retire the implicit binding approach
and introduce a new annotation. So, within a @Templated class that has
a DataBinder<T> field, we should have the following options:
1. No binding
@Inject @DataField
private TextBox date;
2. Binding to model property with matching name
@Inject @Bind @DataField
private TextBox date;
3. Binding to model property with matching name using provided converter
@Inject @Bind(converter=MyDataConverter.class) @DataField
private TextBox date;
4. Binding to model property with provided name
@Inject @Bind(property="lastUpdated") @DataField
private TextBox date;
5. Binding to model property with provided name using provided converter
@Inject @Bind(property="lastUpdated", converter=MyDataConverter.class)
@DataField
private TextBox date;
Additionally, we could add an annotation (e.g. @AutoBind) that when
present on the @Templated class causes our current behaviour. All
@DataFields will be bound to model properties with matching names.
I prefer this approach because just by looking at the code I get all
the information I need to undersand what's going on. Our current
approach seems a little too magical :).
WDYT?
Cheers,
Christian
Show replies by date