com.yandex.div.dsl.Property.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
sealed class Property
class ReferenceProperty internal constructor(val name: String) : Property()
sealed class ValueProperty : Property()
class LiteralProperty internal constructor(val value: T): ValueProperty()
class ExpressionProperty internal constructor(val expression: String): ValueProperty()
fun reference(name: String): ReferenceProperty {
return ReferenceProperty(name)
}
fun value(value: T): LiteralProperty {
return LiteralProperty(value)
}
fun optionalValue(value: T?): LiteralProperty? {
return if (value == null) null else LiteralProperty(value)
}
fun expression(expression: String): ValueProperty {
return ExpressionProperty(expression)
}
fun int(intValue: Int) = value(intValue)
fun number(numberValue: Double) = value(numberValue)
fun bool(boolValue: Boolean) = value(boolValue)
fun string(stringValue: String) = value(stringValue)
fun > enum(enumValue: E) = value(enumValue)