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})
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.