List Property
Stores an ordered list of items where duplicates are allowed.
See properties page to see which property types it can contain. Property definitions need to be required and values can thus not be null.
- Kotlin Definition:
ListDefinition<T>T is for type of value definition - Kotlin Value:
List - Maryk Yaml Definition:
List
Usage options
Section titled “Usage options”- Value
Validation Options
Section titled “Validation Options”required- default truefinal- default falseminSize- default unset. Minimum size of listmaxSize- default unset. Maximum size of list
Other options
Section titled “Other options”default- the default value to be used if value was not set.valueDefinition- definition of values contained
Examples
Section titled “Examples”Example of a List property definition for use within a Model
val names by list( index = 1u, required = false, final = true, valueDefinition = StringDefinition())Example of a separate List property definition
val def = ListDefinition( required = false, final = true, valueDefinition = StringDefinition())Operations
Section titled “Operations”List can be applied with List operations through ListPropertyChange to check
or change their contents. It can be defined with a set with addValuesToEnd or
a list with deleteValues. It can also operate with the value index by
a map with addValuesAtIndex or a list with deleteAtIndex.
The current value can be compared against valueToCompare
Example on a model with a list containing strings.
ListChange( Model { listOfStrings::ref }.change( addValuesToEnd = listOf("three", "four"), deleteValues = listOf("one", "two") ))Example with indexed operations on a model with a list containing strings.
Kotlin:
ListChange( Model { listOfStrings::ref }.change( addValuesAtIndex = mapOf( 0 to "three", 0 to "four" ), deleteAtIndex = setOf(1, 2) ))Indexing list values
Section titled “Indexing list values”List references like refAt(index) and refToAny() (list.*) can be used in filters and changes.
They are not indexable in RootDataModel index definitions.
Storage Byte representation
Section titled “Storage Byte representation”Depends on the specific implementation. The values are stored in their representative byte representation.
Transport Byte representation
Section titled “Transport Byte representation”Lists can be encoded in 2 ways, normal tag/value pairs and packed mode.
In tag/value pairs the values are encoded with a tag referring to the list and the value as their normal transport byte representation.
Tag value pairs
Section titled “Tag value pairs”T V T V T V T V T V
T= Tag + wiretypeV= Value encoded as Length Delimited or Start Group (Until end group)
In Packed encoding multiple values are encoded with one tag representing the specific
list and a Length Delimiter. This is only available and is automatically applied for values
of BIT_32, BIT_64 or VAR_INT wiretype encoding since the sizes of each item are known.
Packed encoding
Section titled “Packed encoding”T L V V V V V
T= Tag + wiretype of Length DelimitedL= VarInt with LengthV= Value encoded asBIT_32,BIT_64orVAR_INT