All Downloads are FREE. Search and download functionalities are using the official Maven repository.

divkit.dsl.ActionArraySetValue.kt Maven / Gradle / Ivy

Go to download

DivKit is an open source Server-Driven UI (SDUI) framework. SDUI is a an emerging technique that leverage the server to build the user interfaces of their mobile app.

There is a newer version: 30.19.0
Show newest version
@file:Suppress(
    "unused",
    "UNUSED_PARAMETER",
)

package divkit.dsl

import com.fasterxml.jackson.annotation.JsonAnyGetter
import com.fasterxml.jackson.annotation.JsonIgnore
import com.fasterxml.jackson.annotation.JsonValue
import divkit.dsl.annotation.*
import divkit.dsl.core.*
import divkit.dsl.scope.*
import kotlin.Any
import kotlin.String
import kotlin.Suppress
import kotlin.collections.List
import kotlin.collections.Map

/**
 * Sets value in the array
 * 
 * Can be created using the method [actionArraySetValue].
 * 
 * Required parameters: `variable_name, value, type, index`.
 */
@Generated
class ActionArraySetValue internal constructor(
    @JsonIgnore
    val properties: Properties,
) : ActionTyped {
    @JsonAnyGetter
    internal fun getJsonProperties(): Map = properties.mergeWith(
        mapOf("type" to "array_set_value")
    )

    operator fun plus(additive: Properties): ActionArraySetValue = ActionArraySetValue(
        Properties(
            index = additive.index ?: properties.index,
            value = additive.value ?: properties.value,
            variableName = additive.variableName ?: properties.variableName,
        )
    )

    class Properties internal constructor(
        val index: Property?,
        val value: Property?,
        val variableName: Property?,
    ) {
        internal fun mergeWith(properties: Map): Map {
            val result = mutableMapOf()
            result.putAll(properties)
            result.tryPutProperty("index", index)
            result.tryPutProperty("value", value)
            result.tryPutProperty("variable_name", variableName)
            return result
        }
    }
}

@Generated
fun DivScope.actionArraySetValue(
    `use named arguments`: Guard = Guard.instance,
    index: Int? = null,
    value: TypedValue? = null,
    variableName: String? = null,
): ActionArraySetValue = ActionArraySetValue(
    ActionArraySetValue.Properties(
        index = valueOrNull(index),
        value = valueOrNull(value),
        variableName = valueOrNull(variableName),
    )
)

@Generated
fun DivScope.actionArraySetValueProps(
    `use named arguments`: Guard = Guard.instance,
    index: Int? = null,
    value: TypedValue? = null,
    variableName: String? = null,
) = ActionArraySetValue.Properties(
    index = valueOrNull(index),
    value = valueOrNull(value),
    variableName = valueOrNull(variableName),
)

@Generated
fun TemplateScope.actionArraySetValueRefs(
    `use named arguments`: Guard = Guard.instance,
    index: ReferenceProperty? = null,
    value: ReferenceProperty? = null,
    variableName: ReferenceProperty? = null,
) = ActionArraySetValue.Properties(
    index = index,
    value = value,
    variableName = variableName,
)

@Generated
fun ActionArraySetValue.override(
    `use named arguments`: Guard = Guard.instance,
    index: Int? = null,
    value: TypedValue? = null,
    variableName: String? = null,
): ActionArraySetValue = ActionArraySetValue(
    ActionArraySetValue.Properties(
        index = valueOrNull(index) ?: properties.index,
        value = valueOrNull(value) ?: properties.value,
        variableName = valueOrNull(variableName) ?: properties.variableName,
    )
)

@Generated
fun ActionArraySetValue.defer(
    `use named arguments`: Guard = Guard.instance,
    index: ReferenceProperty? = null,
    value: ReferenceProperty? = null,
    variableName: ReferenceProperty? = null,
): ActionArraySetValue = ActionArraySetValue(
    ActionArraySetValue.Properties(
        index = index ?: properties.index,
        value = value ?: properties.value,
        variableName = variableName ?: properties.variableName,
    )
)

@Generated
fun ActionArraySetValue.evaluate(
    `use named arguments`: Guard = Guard.instance,
    index: ExpressionProperty? = null,
    variableName: ExpressionProperty? = null,
): ActionArraySetValue = ActionArraySetValue(
    ActionArraySetValue.Properties(
        index = index ?: properties.index,
        value = properties.value,
        variableName = variableName ?: properties.variableName,
    )
)

@Generated
fun ActionArraySetValue.asList() = listOf(this)




© 2015 - 2024 Weber Informatics LLC | Privacy Policy