We are having a SerializationException error when sending a list of objects using RPC and Java Generics.
I'm creating this widget to show the error:
public class Test<T> { ListDataProvider<T> ldp = new ListDataProvider<T>(); public void setItems(List<T> list){ for(T t :list){ ldp.getList().add(t); } } public List<T> getItems(){ return ldp.getList(); } }This is the code for creating the Test widget and passing a list of POJOs (where ExporterFormKey is the POJO object)
List<ExporterFormKey> list = new ArrayList<ExporterFormKey>(); ExporterFormKey key = new ExporterFormKey(); key.setKey("key1"); list.add(key); Test<ExporterFormKey> test = new Test<ExporterFormKey>(); test.setItems(list);At the end the next code throws a SerializationException:
service.sendList(test.getList(), new AsyncCallback...);While the next one does fine:
service.sendList(list, new AsyncCallback...);I found that doing the next code also works
--List<ExporterFormKey> newList = new ArrayList<ExporterFormKey>(test.getItems());
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/mC_WrinxxRkJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
No comments:
Post a Comment