divkit.dsl.InputFilterExpression.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of kotlin-json-builder Show documentation
Show all versions of kotlin-json-builder Show documentation
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.
@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)