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

divkit.dsl.IntegerValue.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

/**
 * Can be created using the method [integerValue].
 * 
 * Required parameters: `value, type`.
 */
@Generated
class IntegerValue internal constructor(
    @JsonIgnore
    val properties: Properties,
) : TypedValue {
    @JsonAnyGetter
    internal fun getJsonProperties(): Map = properties.mergeWith(
        mapOf("type" to "integer")
    )

    operator fun plus(additive: Properties): IntegerValue = IntegerValue(
        Properties(
            value = additive.value ?: properties.value,
        )
    )

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

@Generated
fun DivScope.integerValue(
    `use named arguments`: Guard = Guard.instance,
    value: Int? = null,
): IntegerValue = IntegerValue(
    IntegerValue.Properties(
        value = valueOrNull(value),
    )
)

@Generated
fun DivScope.integerValueProps(
    `use named arguments`: Guard = Guard.instance,
    value: Int? = null,
) = IntegerValue.Properties(
    value = valueOrNull(value),
)

@Generated
fun TemplateScope.integerValueRefs(
    `use named arguments`: Guard = Guard.instance,
    value: ReferenceProperty? = null,
) = IntegerValue.Properties(
    value = value,
)

@Generated
fun IntegerValue.override(
    `use named arguments`: Guard = Guard.instance,
    value: Int? = null,
): IntegerValue = IntegerValue(
    IntegerValue.Properties(
        value = valueOrNull(value) ?: properties.value,
    )
)

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

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy