javalistdictionarygwtrequestfactory

gwt RequestFactory Map containing a List


I want to use a Map<enum, List<Integer>> in a gwt RequestFactory. (I'm using gwt-2.7.0)

According to the latest documentation (which still seems to be for version 2.7.0) this should work.

Map where K and V are transportable types

both K (enum) and V are transportable types.

However, when I run the RequestFactory ValidationTool, I get the following error:

The type java.util.Map<com.example.MyEnum ,java.util.List<java.lang.Integer>> cannot be used here

Note, Map<enum, Integer> does work.

Am I missing something here or is it just not possible?

I couldn't find any answers on google, except for old versions were Maps were not supported at all. I can't believe no one else had this problem since they introduced Maps.

Any workarounds or do I really have to wrap this Map?


Solution

  • This still doesn't seem to be supported. There's an open issue on GitHub:

    RequestFactory support for nested parameterizations.

    Comments suggest wrapping your inner type in a POJO:

    public class MyObject {
        private List<Integer> list;
    }
    

    and the using

    Map<MyEnum, MyObject>