Embedded Values Property
A property that contains values from a selected DataModel. See DataModels for more details on how to define DataModels.
- Kotlin Definition:
EmbeddedValuesDefinition<DM, P>DM is DataModel and P the properties - Kotlin Value:
Values<DM, P>DM is DataModel and P the properties - Maryk Yaml Definition:
Embed
Usage options
Section titled “Usage options”- Value
- Map value
Validation Options
Section titled “Validation Options”required- default truefinal- default false
Other options
Section titled “Other options”default- the default value to be used if value was not set.dataModel- Refers to DataModel to be embedded
Examples
Section titled “Examples”Example of an Embedded Values property definition for use within a Model
val address by embed( index = 1u, required = false, final = true, dataModel = { Address })Example of a separate Embedded Values property definition
val def = EmbeddedValuesDefinition( required = false, final = true, dataModel = { Address })Setting Values (builder DSL)
Section titled “Setting Values (builder DSL)”Embedded values are regular Values<DM> instances. The typical pattern is to build the embedded values with the embedded data model’s create { } and assign it with with.
// Property on a DataModelval address by embed( index = 1u, required = false, dataModel = { Address })
// Setting an embedded value using the builder DSLval user = User.create { address with { street with "Main St" postalCode with "1234AB" // set other fields as needed }}
// Alternative: construct the embedded values beforehandval addr = Address.create { street with "Main St" postalCode with "1234AB"}val user2 = User.create { address with addr}Transport Byte representation
Section titled “Transport Byte representation”All fields of a DataObject are wrapped in a tag/value pair with LENGTH_DELIMITED wiretype and the value starts with the length of the total bytes of the DataObject