Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Client side entity proxies inheritance in GWT Requestfactoy

I use GWT 2.5 RequestFactory, Suppose at server side, I have A, B, C, D 4 entities, at client side, i have AProxy, BProxy,CProxy, DProxy corresponding to server side entities. B, C extends A. In D entity, i have a method:

A getEntity();

which will actually return B or C, At client side, in DProxy, i have:

AProxy getEntity();

My question is At client side, when i get AProxy, can i cast it to BProxy or CProxy, If not, is there a way to get the actual entity proxy?

P.S. In DProxy, i have @ExtraTypes({BProxy,CProxy})

like image 605
Mike Avatar asked Oct 05 '22 04:10

Mike


1 Answers

If BPRoxy extends AProxy with @ProxyFor(B.class) (or equivalent) and CProxy extends AProxy with @ProxyFor(C.class) (or equivalent), then yes, it should work: getEntity() will return either an AProxy, BProxy or CProxy depending on the object returned on the server-side.

like image 135
Thomas Broyer Avatar answered Oct 10 '22 02:10

Thomas Broyer