daml
daml copied to clipboard
Identifier property is missing from ChoiceArgument classes (java-bindings)
When working with ExercisedEvent.class you receive the choiceArgument property which is an Identifier.class
The identifier provides the package, module and entitiyName (where entityName is the choice)
When working with a Template the Identifier of the template is provided as a static field in the Template's generated class.
But the Identifier property is missing from generated Choice classes. There is only the "_packageId` field.
The identifier is used so provide a lookup / match between conversion of a DamlRecord to a typed Choice argument.
each Choice class provides a fromValue() method. But you need to know which specific choice class to use. When ExercisedEvent provides the choiceArgument.recordId value, it is the full Choice Identifier.
Without the identifier, the dev has to create additional mappings against the templateId identifier in the Exercise choice further complicating the mapping process.
Related to https://github.com/digital-asset/daml/issues/14313 (and would likely be subsumed by it)
Specifically, this would be subsumed by the ChoiceMetadata proposal and #12897. The pair (ChoiceMetadata<?, Arg, ...>, Arg) represents the metadata related to Arg being a choice argument type, and the first element itself is more than sufficient to decode Arg. The mapping from choice names to metadata values would be in the companion, as mentioned there.
@ray-roestenburg-da To clarify, our planned approach to #12897 will also close this.