Class ContractCompanion<Ct,Id,Data>
- java.lang.Object
-
- com.daml.ledger.javaapi.data.codegen.ContractTypeCompanion<Data,Data>
-
- com.daml.ledger.javaapi.data.codegen.ContractCompanion<Ct,Id,Data>
-
- Type Parameters:
Ct- TheContractsubclass generated within the template class.Id- TheContractIdsubclass generated within the template class.Data- The generatedTemplatesubclass 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<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
COMPANIONfield on generatedTemplatesubclasses. Allprotectedmembers herein are considered part of the INTERNAL API.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classContractCompanion.WithKey<Ct,Id,Data,Key>static classContractCompanion.WithoutKey<Ct,Id,Data>
-
Field Summary
-
Fields inherited from class com.daml.ledger.javaapi.data.codegen.ContractTypeCompanion
choices, TEMPLATE_ID
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract CtfromCreatedEvent(CreatedEvent event)Tries to parse a contract from an event expected to create aCtcontract.IdtoContractId(ContractId<Data> parameterizedContractId)static <Data> ValueDecoder<Data>valueDecoder(ContractCompanion<?,? extends ContractId<Data>,Data> companion)Static method to generate an implementation ofValueDecoderof typeDatawith metadata from the providedContractCompanion.
-
-
-
Method Detail
-
valueDecoder
public static <Data> ValueDecoder<Data> valueDecoder(ContractCompanion<?,? extends ContractId<Data>,Data> companion)
Static method to generate an implementation ofValueDecoderof typeDatawith metadata from the providedContractCompanion.- Parameters:
companion- an instance ofContractCompanion.- Returns:
- The
ValueDecoderfor parsingValueto get an instance ofData.
-
fromCreatedEvent
public abstract Ct fromCreatedEvent(CreatedEvent event)
Tries to parse a contract from an event expected to create aCtcontract.- Parameters:
event- the event to try to parse a contract from- Returns:
- The parsed contract, with payload and metadata, if present.
- Throws:
java.lang.IllegalArgumentException- when theCreatedEvent.argumentscannot be parsed asData, or theCreatedEvent.contractKeycannot be parsed asKey.
-
toContractId
public Id toContractId(ContractId<Data> parameterizedContractId)
-
-