Let's say I have an interface A which is implemented by classes B and C.
public class B implements A extends Composite {}
public class C implements A extends Composite {}
I created another class D which binds to Ui using UiBinder in GWT.
public class D {
public A widget;
...
// binds to D.ui.xml
...
}
D.ui.xml
...
<A ui:field='widget'>
...
B and C are widgets that bind to their own ui.xml files and are injected into class D under different conditions.
When I try binding UI to interface A (which is either B or C depending on the binding notation) in class D, I get "Expecting only widgets" error which in understandable considering the fact that A doesn't implement Composite or Widget class.
Is there a way to accomplish this behavior, I do not want to create different versions of class D for each behavior?
A
could extend IsWidget
. Also, obviously, make sure your widget
field is @UiField(provided=true)