RequestFactory: can we cast a proxy?

52 views
Skip to first unread message

Manu Botija

unread,
Jan 5, 2014, 10:50:22 AM1/5/14
to google-we...@googlegroups.com
Is there a way, using RequestFactory, to send an entity over the wire specified, not by its type but by the interface that it implements?

For example, the entity below:

public class Action{
    ....
    Ref<Followable> target;
    ....
    public Followable getTarget() {
        return target.get();
    }
}

Action can reference any entity which implements the interface Followable. I want to send instances of ActionProxy including FollowableProxy over the wire and I want my client to be able to downcast FollowableProxy to its actual class (which I happen to know as another property of Action).  Is that even possible? If not, is there another recommended way of implemented this type of generic functionality (Action being able to reference different types of entities)?

(same question but asked differently, in so)

Jens

unread,
Jan 5, 2014, 12:06:00 PM1/5/14
to google-we...@googlegroups.com

Thomas Broyer

unread,
Jan 5, 2014, 2:27:43 PM1/5/14
to google-we...@googlegroups.com
Except that it only works for classes, not interfaces, for the domain objects: https://code.google.com/p/google-web-toolkit/issues/detail?id=5762 

Manu Botija

unread,
Jan 7, 2014, 12:08:38 PM1/7/14
to google-we...@googlegroups.com
Thanks Jens and Thomas. I have it clear now. It would be nice to have the interface support. But it is already very cool to have class polymorphism over the wire. 



--
You received this message because you are subscribed to a topic in the Google Groups "Google Web Toolkit" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-web-toolkit/uFB1MMRIXWY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to google-web-tool...@googlegroups.com.
To post to this group, send email to google-we...@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.

Reply all
Reply to author
Forward
0 new messages