![JAR search and dependency download from the Maven repository](/logo.png)
run.qontract.core.value.BooleanValue.kt Maven / Gradle / Ivy
package run.qontract.core.value
import run.qontract.core.ExampleDeclarations
import run.qontract.core.pattern.BooleanPattern
import run.qontract.core.pattern.ExactValuePattern
import run.qontract.core.pattern.Pattern
data class BooleanValue(val booleanValue: Boolean) : Value, ScalarValue {
override val httpContentType = "text/plain"
override fun displayableValue(): String = toStringValue()
override fun toStringValue() = booleanValue.toString()
override fun displayableType(): String = "boolean"
override fun exactMatchElseType(): Pattern = ExactValuePattern(this)
override fun type(): Pattern = BooleanPattern
override fun typeDeclarationWithKey(key: String, types: Map, exampleDeclarations: ExampleDeclarations): Pair =
primitiveTypeDeclarationWithKey(key, types, exampleDeclarations, displayableType(), booleanValue.toString())
override fun listOf(valueList: List): Value {
return JSONArrayValue(valueList)
}
override fun typeDeclarationWithoutKey(exampleKey: String, types: Map, exampleDeclarations: ExampleDeclarations): Pair =
primitiveTypeDeclarationWithoutKey(exampleKey, types, exampleDeclarations, displayableType(), booleanValue.toString())
override fun toString() = booleanValue.toString()
}
val True = BooleanValue(true)
© 2015 - 2025 Weber Informatics LLC | Privacy Policy