Class ContractCompanion<Ct,​Id,​Data>

  • Type Parameters:
    Ct - The Contract subclass generated within the template class.
    Id - The ContractId subclass generated within the template class.
    Data - The generated Template subclass named after the template, whose instances contain only the payload.
    Direct Known Subclasses:
    ContractCompanion.WithKey, ContractCompanion.WithoutKey

    public abstract class ContractCompanion<Ct,​Id,​Data>
    extends ContractTypeCompanion<Ct,​Id,​Data,​Data>
    Metadata and utilities associated with a template as a whole, rather than one single contract made from that template.

    Application code should not instantiate or subclass; instead, refer to the COMPANION field on generated Template subclasses. All protected members herein are considered part of the INTERNAL API.

    Every instance is either a ContractCompanion.WithKey or ContractCompanion.WithoutKey, depending on whether the template defined a key type. ContractCompanion.WithKey defines extra utilities for working with contract keys.

    • Constructor Detail

      • ContractCompanion

        protected ContractCompanion​(java.lang.String templateClassName,
                                    Identifier templateId,
                                    java.util.function.Function<java.lang.String,​Id> newContractId,
                                    java.util.function.Function<DamlRecord,​Data> fromValue,
                                    ContractCompanion.FromJson<Data> fromJson,
                                    java.util.List<Choice<Data,​?,​?>> choices)
    • Method Detail

      • valueDecoder

        public static <Data> ValueDecoder<Data> valueDecoder​(ContractCompanion<?,​? extends ContractId<Data>,​Data> companion)
        Static method to generate an implementation of ValueDecoder of type Data with metadata from the provided ContractCompanion.
        Parameters:
        companion - an instance of ContractCompanion.
        Returns:
        The ValueDecoder for parsing Value to get an instance of Data.