Reputation: 86627
I have a List<Foo> foos
which I can send to a GWT RPC service
without problems.
But if I wrap that list into a new object, I'm getting an exception on startup.
subtype MyDTO is not assignable to 'com.google.gwt.user.client.rpc.IsSerializable' or 'java.io.Serializable' nor does it have a custom field serializer (reached via MyDTO)
Why can I send the list itself, but not a wrapper object?
with:
class MyDTO {
List<Foo> foos; //containing Rectanlges (see below)
public MyDTO() {}
List<Foo> getFoos() { return foos; }
void setFoos(List<Foo> foots) { this.foos = foos; }
}
with Foo beeing an interface like:
interface Foo {
abstract int getX();
abstract void setX(int x);
}
class Rectangle implements Foo {
private int x;
public Rectangle() {};
//impl of foo methods
}
Of course this structure does not make much sence, but it describes my problem. If I just send the List foos via RPC everything works fine.
If I send the MyDTO wrapper holding the list of foos, mentioned Exception is thrown. What is wrong here?
Upvotes: 1
Views: 149
Reputation: 21883
Make MyDTO implement Serializable
. List
is Serializable by default.
Upvotes: 4