Hi Jason,
Ok, so when I print out the actual object references for the DynamicMessage and the GeneratedMessage.Builder objects, I get the following:
java.lang.IllegalArgumentException: Msg was withh reference com.google.protobuf.Descriptors$Descriptor@5675d86b; expected object reference com.google.protobuf.Descriptors$Descriptor@1dfe3aa4
Based on your explanation, this would not work.
So I see 2 solutions:
1.) In my descriptor map, I'd put the descriptor of the objects directly, such as SRI.getDescriptor() <-- I tested this and it worked
2.) I use the descriptor file to generate builders with the same descriptor as the descriptors in the descriptor file, and pass that into the getGeneratedMessage function.
I'm not sure what the best solution here is, but in the case of solution 1, it seems as though I would need to know ahead of time how many messages I have generated, and add them all into my hashmap manually. For example, lets say I had SRI, CSN, ABC message types? Then, I'd have to add into my hashmap 3 entries with descriptors SRI.getDescriptor(), CSN.getDescriptor(), and ABC.getDescriptor(). Seems kind of cumbersome unless I am missing something?
The 2nd solution that I described might be a bit cleaner atleast in terms of implementation, BUT, I don't see anything in the API that can generate a GeneratedMessage.Builder from a Descriptor? My idea would have been to pass in a GeneratedMessage.Builder object that was geenrated from the descriptor that was read in from the file.
Any suggestions?
Thanks again,
Kiran