com.yandex.div.dsl.context.Templates.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.
package com.yandex.div.dsl.context
import com.yandex.div.dsl.Property
import com.yandex.div.dsl.ReferenceProperty
import com.yandex.div.dsl.ValueProperty
import com.yandex.div.dsl.value
sealed class TemplateBinding
class PropertyOverriding internal constructor(
val name: String,
val property: Property
) : TemplateBinding()
fun TemplateContext<*>.override(name: String, property: Property): PropertyOverriding {
return PropertyOverriding(name, property)
}
fun TemplateContext<*>.override(name: String, value: T): PropertyOverriding {
return PropertyOverriding(name, value(value))
}
fun CardContext.override(name: String, property: ValueProperty): PropertyOverriding {
return PropertyOverriding(name, property)
}
fun CardContext.override(name: String, value: T): PropertyOverriding {
return PropertyOverriding(name, value(value))
}
class ReferenceResolving internal constructor(
val reference: ReferenceProperty,
val property: ValueProperty
) : TemplateBinding()
fun CardContext.resolve(reference: ReferenceProperty, property: ValueProperty): ReferenceResolving {
return ReferenceResolving(reference, property)
}
fun CardContext.resolve(reference: ReferenceProperty, value: T): ReferenceResolving {
return ReferenceResolving(reference, value(value))
}