I have a little problem with a list that contains different types of elements and i would like to see if anyone of you have met the problem before. The issue should be solved with the use of @ExtraTypes, but it is not working for me, so i guess i am not using it correctly. So, the scenario is (bean names are changed for clarity):
GENERAL:
- I am using GWT 2.5 with RequestFactory.
SERVER-SIDE:
- I have a RootBean that contains, among other stuff, a
List <ChildBean>
. - This ChildBean contains some primitive attributes.
- ChildBean is also extended by a MoreSpecificChildBean that inherits all the parent attributes and adds a few more.
- The RootBean gets its list filled up with elements of type ChildBean and MoreSpecificChildBean depending on some logic.
CLIENT-SIDE:
IRootBeanProxy is a ValueProxy with these annotations:
@ProxyFor (value = RootBean.class) @ExtraTypes ({IMoreSpecificChildBeanProxy.class})
and contains a list
List <IChildBeanProxy> getChildren ();
- IChildBeanProxy is a ValueProxy:
@ProxyFor (value=ChildBean) public interface IChildBeanProxy extends ValueProxy
- IMoreSpecificChildBeanProxy is a ValueProxy:
@ProxyFor (value=MoreSpecificChildBean) public interface IMoreSpecificChildBeanProxy extends IChildBeanProxy
- the Request context has a method that returns Request and i added the @ExtraTypes annotation here too:
@Service (value = CompareService.class, locator = SpringServiceLocator.class) @ExtraTypes ({IChildBeanProxy.class, IMoreSpecificChildBeanProxy.class}) public interface ICompareRequestContext extends RequestContext { Request <IRootBeanProxy> compare (Integer id1, Integer id2);
Question
Supposedly with those annotations, RF should be aware of the existence of polymorphic inherited classes, but all i get in the client is an IRootBeanProxy with a list of IChildBeanProxy elements. This list includes the MoreSpecificChildBean, but in the shape of a IChildBeanProxy, so that i cannot tell it from the others. So i am wondering what i am doing wrong, if i am setting the ExtraTypes annotation at the wrong place or something.
Anyone?
Thx for all the help!!
DeobfuscatorBuilderImplclass related to your proxies and domain classes? Also try to set a breakpoint incom.google.web.bindery.requestfactory.server.ResolverServiceLayer#resolveClientTypeto see what happens there. - Thomas Broyerverboseprocessor option (on the command line, that's be-Averbose) and see how it scans your interfaces (logs are emitted as warnings, that's so they show in Eclipse right in the editor) - Thomas Broyer