There is just one minor issue with the protobuf in the question: the innermost map uses subData
and the outer map uses SubDataList
, but it should be the other way round:
message DataCollectionMessage {
message SubData {
message SubDataList {
repeated string data = 1;
}
map<string, SubDataList> parameters = 1;
}
map<string, SubData> parameters = 1;
}
(I've also capitalized SubData
for consistency.)
The generated Java code will have the following classes (snipped and reordered for clarity):
public static final class DataCollectionMessage {
public Map<String, DataCollectionMessage.SubData> getParametersMap() { ... }
public static final class SubData {
public Map<String, DataCollectionMessage.SubData.SubDataList> getParametersMap() { ... }
public static final class SubDataList {
public ProtocolStringList getDataList() { ... }
}
}
}
Note that SubDataList
has a ProtocolStringList
, which is like List<String>
.
If you get different results, post the protobuf file that you are using and the relevant parts of the generated Java code.