Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

interface view decoders #15125

Closed
4 tasks done
S11001001 opened this issue Sep 28, 2022 · 3 comments · Fixed by #15143
Closed
4 tasks done

interface view decoders #15125

S11001001 opened this issue Sep 28, 2022 · 3 comments · Fixed by #15143
Assignees
Labels
component/java-ecosystem Java development experience ledger clients facade enriching the ledger API by bindings/codegen, JSON API, custom view roadmap/interfaces https://digitalasset.atlassian.net/browse/DAML-56 team/ledger-clients Related to the Ledger Clients team's components.

Comments

@S11001001
Copy link
Contributor

S11001001 commented Sep 28, 2022

Build upon #14313, and support #14969, by having InterfaceCompanion also supply a ValueDecoder<View>.

  • ValueDecoder Interface #15017
  • InterfaceCompanion's tparams should be <I, View>
  • ContractTypeCompanion's tparams should be <Marker, Data>. ContractCompanion should pass Data for both. They should be I, View for InterfaceCompanion
  • change the INTERFACE class we generate to pass the view type as the second tparam, and pass a ValueDecoder<View> as a param to super
@S11001001 S11001001 added component/java-ecosystem Java development experience team/ledger-clients Related to the Ledger Clients team's components. ledger clients facade enriching the ledger API by bindings/codegen, JSON API, custom view labels Sep 28, 2022
@S11001001 S11001001 added the roadmap/interfaces https://digitalasset.atlassian.net/browse/DAML-56 label Sep 29, 2022
@chunlokling-da chunlokling-da self-assigned this Sep 30, 2022
@chunlokling-da
Copy link
Contributor

chunlokling-da commented Sep 30, 2022

I am thinking about whether to put the public final ValueDecoder<Data> valueDecoder in InterfaceCompanion or ContractTypeCompanion. I believe we ultimately would like to put it in ContractTypeCompanion as the both template and interface should provide a ValueDecoder<>. I tried to put it in ContractTypeCompanion but I found some changes required in generate Template class. @S11001001 Do you think it is good enough for this issue to put the valueDecoder in InterfaceCompanion but not in ContractTypeCompanion yet?

@S11001001
Copy link
Contributor Author

Do you think it is good enough for this issue to put the valueDecoder in InterfaceCompanion but not in ContractTypeCompanion yet?

@chunlokling-da It can be put in all three. Define this (package-private) method:

<Z> Z fold(Function<? super ContractCompanion<?, ?, Data>, Z> template,
    Function<? super InterfaceCompanion<Marker, Data>, Z> iface)

and then implementing valueDecoder in the ContractTypeCompanion by calling the other two should become straightforward.

@S11001001
Copy link
Contributor Author

@chunlokling-da On the other hand, maybe not so straightforward. Yeah, it's fine to have it in the InterfaceCompanion but not in ContractTypeCompanion for this issue. However, I think this might imply that we have a problem with decoding interface contract IDs that we should fix separately.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/java-ecosystem Java development experience ledger clients facade enriching the ledger API by bindings/codegen, JSON API, custom view roadmap/interfaces https://digitalasset.atlassian.net/browse/DAML-56 team/ledger-clients Related to the Ledger Clients team's components.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants