Skip to main content

Back to Java Bindings

Java package

com.daml.ledger.javaapi.data.codegen

32 current types

Types

ByKey
JavaAdded 3.4.8

Parent of all generated ByKey classes within templates and interfaces.

ByKey.ToInterface
JavaAdded 3.4.8

Parent of all generated ByKey classes within interfaces. These need to pass both the template and interface ID.

Choice
JavaAdded 3.4.8

This represents a Daml choice that can be exercised on ContractIds of type ContractId<Tpl>.

Contract
JavaAdded 3.4.8

A superclass for all codegen-generated Contracts.

ContractCompanion
JavaAdded 3.4.8

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.

Java type reference.

Java type reference.

Java type reference.

Java type reference.

Java type reference.

ContractDecoder
JavaAdded 3.4.8

Java type reference.

ContractId
JavaAdded 3.4.8

This class is used as a super class for all concrete ContractIds generated by the java codegen with the following properties: Foo.ContractId fooCid = new Foo.ContractId(“test”); Bar.ContractId barCid = new Bar.ContractId(“test”); ContractId<Foo> genericFooCid = new ContractId<>(“test”); ContractId<Foo> genericBarCid = new ContractId<>(“test”); fooCid.equals(genericFooCid) == true; genericFooCid.equals(fooCid) == true; fooCid.equals(barCid) == false; barCid.equals(fooCid) == false; Due to erase, we cannot distinguish ContractId<Foo> from ContractId<Bar>, thus: fooCid.equals(genericBarCid) == true genericBarCid.equals(fooCid) == true genericFooCid.equals(genericBarCid) == true genericBarCid.equals(genericFooCid) == true

ContractTypeCompanion
JavaAdded 3.4.8

The commonality between ContractCompanion and InterfaceCompanion.

Java type reference.

ContractWithKey
JavaAdded 3.4.8

A superclass for all codegen-generated Contracts whose templates have a key defined.

CreateAnd
JavaAdded 3.4.8

Parent of all generated CreateAnd classes within templates and interfaces.

CreateAnd.ToInterface
JavaAdded 3.4.8

Parent of all generated CreateAnd classes within interfaces. These need to pass both the template and interface ID.

Created
JavaAdded 3.4.8

This class contains information related to a result after a contract is created. Application code should not instantiate or subclass;

DamlEnum
JavaAdded 3.4.8

Base interface of all decoded-to-codegen Daml enums. Its encoded counterpart is DamlEnum, which can be produced with toValue().

DamlRecord
JavaAdded 3.4.8

Base class of all decoded-to-codegen Daml records with no type parameters. This category includes all Template payloads, all interface views, and [by convention albeit not by rule] all choice arguments. Its encoded counterpart is DamlRecord, which can be produced with toValue().

DefinedDataType
JavaAdded 3.4.8

The codegen-decoded form of any of these: what DamlRecord describes, a Variant without type parameters, or any DamlEnum. Its encoded counterpart is Value, which can be produced with toValue().

Exercised
JavaAdded 3.4.8

This class contains information related to the result after a choice is exercised. Application code should not instantiate or subclass;

Exercises
JavaAdded 3.4.8

Root of all generated Exercises interfaces for templates and Daml interfaces.

Exercises.Archivable
JavaAdded 3.4.8

Adds exerciseArchive() to every exercise target. The goal is to correct the problem of having ContractId implement Exercises.makeExerciseCmd(com.daml.ledger.javaapi.data.codegen.Choice<?, ? super A, R>, A) directly. That was a mistake, but one at least obviated by the fact that Exercises.makeExerciseCmd(com.daml.ledger.javaapi.data.codegen.Choice<?, ? super A, R>, A) is clearly part of the internal API, so if you use it directly anyway and you get weird exceptions, you get to keep both pieces of your program. With exerciseArchive() we can correct the problem by having Exercises.Archivable be the real Exercises interface, and the distinction can be flattened when breaking compatibility.

HasCommands
JavaAdded 3.4.8

This is an interface describing classes that contains or can generate a list of Command

InterfaceCompanion
JavaAdded 3.4.8

Metadata and utilities associated with an interface as a whole. Its subclasses serve to disambiguate various generated toInterface overloads.

Java type reference.

PrimitiveValueDecoders
JavaAdded 3.4.8

ValueDecoders for Daml types that are not code-generated.

Policy for handling unknown trailing fields when decoding a Daml record into a Java Class by codegen

Update
JavaAdded 3.4.8

Java type reference.

ValueDecoder
JavaAdded 3.4.8

A converter from the encoded form of a Daml value, represented by Value, to the codegen-decoded form, represented by Data. Every codegen class for a template, record, or variant includes a valueDecoder method that produces one of these. If the data type has type parameters, valueDecoder has arguments that correspond to ValueDecoders for those type arguments. For primitive types that are not code-generated, see PrimitiveValueDecoders. // given template ‘Foo’, and encoded payload ‘Value fooValue’ Foo foo = Foo.valueDecoder().decode(fooValue); // given Daml datatypes ‘Bar a b’ and ‘Baz’, // and encoded ‘Bar’ ‘Value barValue’ Bar<Baz, Long> bar = Bar.valueDecoder( Baz.valueDecoder(), PrimitiveValueDecoders.fromInt64) .decode(barValue); Bar<List<Baz>, Map<Long, String>> barWithAggregates = Bar.valueDecoder( PrimitiveValueDecoders.fromList(Baz.valueDecoder), PrimitiveValueDecoders.fromGenMap( PrimitiveValueDecoders.fromInt64, PrimitiveValueDecoders.fromText)) .decode(barAggregateValue); There is also a decode(Value, UnknownTrailingFieldPolicy) method that takes an additional UnknownTrailingFieldPolicy This method is used to handle unknown trailing fields in the value. Currently, the error is thrown if there are unknown trailing fields or extra fields are ignored. In the following situation if the following DAML data object is defined in the DAML project on the client side: data Bar = Bar { bar : Int, baz: Int } deriving (Eq, Show) And the following value is received from the ledger: Value(1, 2, Optional(3)) if the following code is executed on the client side, the IllegalArgumentException is thrown: Bar bar = Bar.valueDecoder().decode(value, UnknownTrailingFieldPolicy.STRICT); and if the following code is executed on the client side, the Bar object is created with bar = 1 and baz = 2, while the extra field 3 is ignored: Bar bar = Bar.valueDecoder().decode(value, UnknownTrailingFieldPolicy.IGNORE);

Variant
JavaAdded 3.4.8

Base class of all decoded-to-codegen Daml variants with no type parameters. Its encoded counterpart is Variant, which can be produced with toValue().

History

Added3.5.1

com.daml.ledger.javaapi.data.codegen.UnknownTrailingFieldPolicy

Added3.4.8

com.daml.ledger.javaapi.data.codegen.ByKey

com.daml.ledger.javaapi.data.codegen.ByKey.ToInterface

com.daml.ledger.javaapi.data.codegen.Choice

com.daml.ledger.javaapi.data.codegen.Contract

com.daml.ledger.javaapi.data.codegen.ContractCompanion

com.daml.ledger.javaapi.data.codegen.ContractCompanion.FromJson

com.daml.ledger.javaapi.data.codegen.ContractCompanion.WithKey

com.daml.ledger.javaapi.data.codegen.ContractCompanion.WithKey.NewContract

com.daml.ledger.javaapi.data.codegen.ContractCompanion.WithoutKey

com.daml.ledger.javaapi.data.codegen.ContractCompanion.WithoutKey.NewContract

com.daml.ledger.javaapi.data.codegen.ContractDecoder

com.daml.ledger.javaapi.data.codegen.ContractId

com.daml.ledger.javaapi.data.codegen.ContractTypeCompanion

com.daml.ledger.javaapi.data.codegen.ContractTypeCompanion.Package

com.daml.ledger.javaapi.data.codegen.ContractWithKey

com.daml.ledger.javaapi.data.codegen.CreateAnd

com.daml.ledger.javaapi.data.codegen.CreateAnd.ToInterface

com.daml.ledger.javaapi.data.codegen.Created

com.daml.ledger.javaapi.data.codegen.DamlEnum

com.daml.ledger.javaapi.data.codegen.DamlRecord

com.daml.ledger.javaapi.data.codegen.DefinedDataType

com.daml.ledger.javaapi.data.codegen.Exercised

com.daml.ledger.javaapi.data.codegen.Exercises

com.daml.ledger.javaapi.data.codegen.Exercises.Archivable

com.daml.ledger.javaapi.data.codegen.HasCommands

com.daml.ledger.javaapi.data.codegen.InterfaceCompanion

com.daml.ledger.javaapi.data.codegen.InterfaceCompanion.FromJson

com.daml.ledger.javaapi.data.codegen.PrimitiveValueDecoders

com.daml.ledger.javaapi.data.codegen.Update

com.daml.ledger.javaapi.data.codegen.ValueDecoder

com.daml.ledger.javaapi.data.codegen.Variant