Following are my domain classes
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 {
}
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 error:
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?
You should write proxy interfaces for Motorocycle
and Car
instead of proxy interface for interface Vehicle
. I've never used requestfactory proxy interfaces for interfaces (not classes), and in my opinion that's the reason you are getting this exception.
[EDIT]
In such case as above, you will have to move Vehicle
interface to the shared
package so that both server and client site would see it. That's very common solution in case of enums - domain classes has some enum property and proxy interface must also contains accessors for this property.
Other solution (which I think may not work) is to write proxy interface for Vehicle
interface and your proxy interfaces for Motorocycle
and Car
should extend it.