Method in RequestContext interface containing Map as return type

832 Views Asked by At

Am getting error while trying to do this. Am using gwt2.5 and requestfactory.

My server class looks like this:

public class RuleConfiguration {

    public static Map<Long, List<Operator>> getDataTypeOperatorMappings() {
        return DataTypeOperatorMappingHelper.getInstance().getValidDataTypeToOperatorMappings();
    }
}

And corresponding RequestContextClass looks like this

import java.util.List;
import java.util.Map;


@Service( value = RuleConfiguration.class )
public interface RuleRequestContext extends RequestContext {

    Request<Map<Long, List<OperatorProxy>>> getDataTypeOperatorMappings();
}

But here am getting an error saying The type java.util.Map<"map signature"> cannot be used here

What is my mistake here? Kindly help. Thanks.

1

There are 1 best solutions below

2
Deanna On BEST ANSWER

If you look here https://developers.google.com/web-toolkit/doc/latest/DevGuideRequestFactory It doesn't list Map as a transportable type - only List and Set. I had this problem once and solved it by breaking the map into two ArrayList where the index of one was the data for the other.