Class ContractCompanion<Ct,Id,Data>
- java.lang.Object
-
- com.daml.ledger.javaapi.data.codegen.ContractTypeCompanion
-
- 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
Metadata and utilities associated with a template as a whole, rather than one single contract made from that template.
-
-
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 Modifier and Type Field Description protected java.util.function.Function<DamlRecord,Data>fromValueprotected java.util.function.Function<java.lang.String,Id>newContractId-
Fields inherited from class com.daml.ledger.javaapi.data.codegen.ContractTypeCompanion
TEMPLATE_ID
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedContractCompanion(java.lang.String templateClassName, Identifier templateId, java.util.function.Function<java.lang.String,Id> newContractId, java.util.function.Function<DamlRecord,Data> fromValue)
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description abstract CtfromCreatedEvent(CreatedEvent event)Tries to parse a contract from an event expected to create aCtcontract.
-
-
-
Field Detail
-
newContractId
protected final java.util.function.Function<java.lang.String,Id> newContractId
-
fromValue
protected final java.util.function.Function<DamlRecord,Data> fromValue
-
-
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)
-
-
Method Detail
-
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.
-
-