RequestFactory with ValueType for interfaces / abstract classes

48 views
Skip to first unread message

Nachiket

unread,
Aug 6, 2011, 9:38:44 AM8/6/11
to Google Web Toolkit
Hi,
Following is my Model
---------------------------
class Person {
String getName();
Vehicle getVehicle();
}

interface Vehicle {
String getCompanyName();
String getRegNo();
Point getParkingSpaceRequired();
}

abstract class AbstractVehicle {
}

class Motorcycle extends AbstractVehicle {
}

class Car extends AbstractVehicle {
}

------------------------------
so creating PersonProxy as EntityProxy was straight forward, and
working fine for person.getName()
I have created VehicleProxy as ValueProxy and called fire()
with .with('vehicle')

But I am getting
The domain type com....AbstractVehicle$$EnhancerByCGLIB$$e86549b9
cannot be sent to the client.

On PersonProxy I got
@ProxyFor(value=Person.class,locator=PersonLocator.class)

on VehicleProxy I got
@ProxyFor(value=Vehicle.class)

so, How to handle such inheritance in RequestFactory?
Should I change Vehicle to EntityProxy from ValueProxy? Then How to
implement methods of VehicleLocator?

Thank you,


Nachiket

unread,
Aug 9, 2011, 2:33:33 AM8/9/11
to Google Web Toolkit
Update:

I found that @ExtraTypes is supported in GWT 2.4 for polymorphic
support in RequestFactory.
But unable to understand how to use it, as there are no sample code
available which does that.

Although got this test class which does check polymorphism in request
factory.
http://www.google.com/codesearch#A1edwVHBClQ/user/test/com/google/web/bindery/requestfactory/gwt/client/RequestFactoryPolymorphicTest.java

But there are no sign,how to use Abstract classes..

Looking for pointers/guidance.

Thanks,
Reply all
Reply to author
Forward
0 new messages