Files
divkit/api_generator/tests/references/kotlin/EntityWithStringArrayProperty.kt
T
2022-11-10 15:34:33 +03:00

62 lines
1.8 KiB
Kotlin

// Generated code. Do not modify.
package com.yandex.div2
import android.graphics.Color
import android.net.Uri
import androidx.annotation.ColorInt
import com.yandex.div.json.*
import com.yandex.div.json.expressions.Expression
import com.yandex.div.json.expressions.ExpressionsList
import com.yandex.div.json.schema.*
import com.yandex.div.core.annotations.Mockable
import java.io.IOException
import java.util.BitSet
import org.json.JSONObject
import com.yandex.div.data.*
@Mockable
class EntityWithStringArrayProperty(
@JvmField final val array: ExpressionsList<String>, // at least 1 elements
) : JSONSerializable {
override fun writeToJSON(): JSONObject {
val json = JSONObject()
json.writeExpressionsList(key = "array", value = array)
json.write(key = "type", value = TYPE)
return json
}
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}
other ?: return false
if (other !is EntityWithStringArrayProperty) {
return false
}
if (array != other.array) {
return false
}
return true
}
companion object {
const val TYPE = "entity_with_string_array_property"
@JvmStatic
@JvmName("fromJson")
operator fun invoke(env: ParsingEnvironment, json: JSONObject): EntityWithStringArrayProperty {
val logger = env.logger
return EntityWithStringArrayProperty(
array = JsonParser.readExpressionsList(json, "array", ARRAY_VALIDATOR, logger, env, TYPE_HELPER_STRING)
)
}
private val ARRAY_VALIDATOR = ListValidator<String> { it: List<*> -> it.size >= 1 }
val CREATOR = { env: ParsingEnvironment, it: JSONObject -> EntityWithStringArrayProperty(env, json = it) }
}
}