trait SchemaVisitor extends AnyRef
This trait describes various types that a Daml package can contain. SchemaProcessor
will use
an implementation of this trait to feed types into the visitor. The visitor implementation
should define SchemaVisitor.Type, which can be a Codec, or a Code-generator along with
instructions how to process daml types. There are several use cases:
Codecs
To achieve the best performance, a codec should create a tree-like structure copying the structure of Daml types with each node processing corresponding daml type and delegating processing to the next node if it's a type container.
A codec should convert to and from DynamicValue instances. This allows to compose codecs
from various protocols by combining them in com.digitalasset.transcode.Converter. For
example, one code combine JsonCodec
and GrpcValueCodec
to get direct conversions from json
to Ledger API proto values and vice versa. Or one can compose JsonCodec
and ScalaCodec
, etc.
Code generators
Code generators can produce code snippets at each handler and combine them into a file or a set of files that can be used as generated source in the target language.
It is advisable to also generate a codec along with DTOs (Data Transfer Object) to allow for direct interoperability with other existing protocols (Json or Protobuf).
- Alphabetic
- By Inheritance
- SchemaVisitor
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Type Members
- abstract type Type
Visitor handler type for various DAML schema cases.
Abstract Value Members
- abstract def bool: Type
Boolean
- abstract def contractId(template: Type): Type
Contract Id, parametrized with the processor for corresponding template
- abstract def date: Type
Date
- abstract def enum(id: Identifier, cases: Seq[EnumConName]): Type
ADT, Sum type - special case, where there are only named constructors without further payloads
- abstract def genMap(key: Type, value: Type): Type
Map with keys and values of any type
- abstract def int64: Type
8-byte Integer
- abstract def interface(name: Identifier): Type
Interface.
Interface. Used in code-gens. There is no representation of interface in Dynamic Value
- abstract def list(elem: Type): Type
Sequence of elements
- abstract def numeric(scale: Int): Type
Numeric with scale
- abstract def optional(elem: Type): Type
Optional element
- abstract def party: Type
Party
- abstract def record(id: Identifier, appliedArgs: => Seq[(TypeVarName, Type)], fields: => Seq[(FieldName, Type)]): Type
ADT, Product type
- abstract def text: Type
Text
- abstract def textMap(value: Type): Type
Map with keys of String/Text type
- abstract def timestamp: Type
Timestamp
- abstract def unit: Type
Unit
- abstract def variable(name: TypeVarName, value: Type): Type
Type Variable.
Type Variable.
Codecs might want to use
value
substitution, effectively replacing type variables with concrete types, while code generators might want to use type variable names. - abstract def variant(id: Identifier, appliedArgs: => Seq[(TypeVarName, Type)], cases: => Seq[(VariantConName, Type)]): Type
ADT, Sum type
Concrete Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @IntrinsicCandidate() @native()
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @IntrinsicCandidate() @native()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @IntrinsicCandidate() @native()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @IntrinsicCandidate() @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @IntrinsicCandidate() @native()
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])