Help with generics or inheritance with RequestFactory

179 views
Skip to first unread message

Andigator

unread,
Jan 10, 2011, 5:54:33 PM1/10/11
to Google Web Toolkit
Will RequestFactory support the use of generics and/or inheritance on
ValueProxy?

For example, say I have FruitValueProxy. AppleProxy, OrangeProxy and
GrapeProxy extend it. My EntityProxy must have setters for all three
fruits individually instead of just writing setFruit(FruitValueProxy
proxy). Is there a workaround or plans for improvement?

Y2i

unread,
Jan 10, 2011, 8:56:43 PM1/10/11
to Google Web Toolkit
It looks like the feature request was accepted:

http://code.google.com/p/google-web-toolkit/issues/detail?id=5367

This is an workaround, but it's how I'm planning to deal with the
polymorphism until it's fully supported by the request factory.

---------------------------------------------
interface FruitWrapper extends ValueProxy {
// returns null if the fruit is not an apple
AppleProxy getApple();
// returns null if the fruit is not a grape
GrapeProxy getGrape();
// etc...
// ...
}

interface MyEntityProxy extends EntityProxy {
void setFruit(FruitWrapper fruit);
FruitWrapper getFruit();

// More important is querying various fruits
List<FruitWrapper> queryFruits(some parameters);
}
---------------------------------------------

If there is a better option please share, I'd be very interested...

Y2i

unread,
Jan 10, 2011, 9:02:12 PM1/10/11
to Google Web Toolkit
I meant to say "This is an ugly workaround..."

Andigator

unread,
Jan 13, 2011, 11:19:03 AM1/13/11
to Google Web Toolkit
Thanks for your help! I like this better than my current workaround
(having a setter for each proxy).

On Jan 10, 8:56 pm, Y2i <yur...@gmail.com> wrote:
> It looks like the feature request was accepted:
>
> http://code.google.com/p/google-web-toolkit/issues/detail?id=5367
>
> This is an workaround, but it's how I'm planning to deal with thepolymorphismuntil it's fully supported by the request factory.
>
Reply all
Reply to author
Forward
0 new messages