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

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

/**
 * [Calculated expression](../../expressions) filter.
 * 
 * Can be created using the method [inputFilterExpression].
 * 
 * Required parameters: `type, condition`.
 */
@Generated
class InputFilterExpression internal constructor(
    @JsonIgnore
    val properties: Properties,
) : InputFilter {
    @JsonAnyGetter
    internal fun getJsonProperties(): Map = properties.mergeWith(
        mapOf("type" to "expression")
    )

    operator fun plus(additive: Properties): InputFilterExpression = InputFilterExpression(
        Properties(
            condition = additive.condition ?: properties.condition,
        )
    )

    class Properties internal constructor(
        /**
         * [Calculated expression](../../expressions) used as a value validity condition.
         */
        val condition: Property?,
    ) {
        internal fun mergeWith(properties: Map): Map {
            val result = mutableMapOf()
            result.putAll(properties)
            result.tryPutProperty("condition", condition)
            return result
        }
    }
}

/**
 * @param condition [Calculated expression](../../expressions) used as a value validity condition.
 */
@Generated
fun DivScope.inputFilterExpression(
    `use named arguments`: Guard = Guard.instance,
    condition: Boolean? = null,
): InputFilterExpression = InputFilterExpression(
    InputFilterExpression.Properties(
        condition = valueOrNull(condition),
    )
)

/**
 * @param condition [Calculated expression](../../expressions) used as a value validity condition.
 */
@Generated
fun DivScope.inputFilterExpressionProps(
    `use named arguments`: Guard = Guard.instance,
    condition: Boolean? = null,
) = InputFilterExpression.Properties(
    condition = valueOrNull(condition),
)

/**
 * @param condition [Calculated expression](../../expressions) used as a value validity condition.
 */
@Generated
fun TemplateScope.inputFilterExpressionRefs(
    `use named arguments`: Guard = Guard.instance,
    condition: ReferenceProperty? = null,
) = InputFilterExpression.Properties(
    condition = condition,
)

/**
 * @param condition [Calculated expression](../../expressions) used as a value validity condition.
 */
@Generated
fun InputFilterExpression.override(
    `use named arguments`: Guard = Guard.instance,
    condition: Boolean? = null,
): InputFilterExpression = InputFilterExpression(
    InputFilterExpression.Properties(
        condition = valueOrNull(condition) ?: properties.condition,
    )
)

/**
 * @param condition [Calculated expression](../../expressions) used as a value validity condition.
 */
@Generated
fun InputFilterExpression.defer(
    `use named arguments`: Guard = Guard.instance,
    condition: ReferenceProperty? = null,
): InputFilterExpression = InputFilterExpression(
    InputFilterExpression.Properties(
        condition = condition ?: properties.condition,
    )
)

/**
 * @param condition [Calculated expression](../../expressions) used as a value validity condition.
 */
@Generated
fun InputFilterExpression.evaluate(
    `use named arguments`: Guard = Guard.instance,
    condition: ExpressionProperty? = null,
): InputFilterExpression = InputFilterExpression(
    InputFilterExpression.Properties(
        condition = condition ?: properties.condition,
    )
)

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy