Files
gulevsky c9caf87860 add code generation of json serializers
commit_hash:3ad603b95c6c6ead4feaa591da3fbe2e91751455
2024-09-25 12:55:58 +03:00

66 lines
1.6 KiB
Kotlin

// Generated code. Do not modify.
package com.yandex.div.reference
import org.json.JSONArray
import org.json.JSONObject
class EntityWithStringEnumProperty(
@JvmField val property: Expression<Property>,
) : Hashable {
private var _hash: Int? = null
override fun hash(): Int {
_hash?.let {
return it
}
val hash =
this::class.hashCode() +
property.hashCode()
_hash = hash
return hash
}
fun equals(other: EntityWithStringEnumProperty?, resolver: ExpressionResolver, otherResolver: ExpressionResolver): Boolean {
other ?: return false
return property.evaluate(resolver) == other.property.evaluate(otherResolver)
}
fun copy(
property: Expression<Property> = this.property,
) = EntityWithStringEnumProperty(
property = property,
)
companion object {
const val TYPE = "entity_with_string_enum_property"
}
enum class Property(private val value: String) {
FIRST("first"),
SECOND("second");
companion object Converter {
fun toString(obj: Property): String {
return obj.value
}
fun fromString(value: String): Property? {
return when (value) {
FIRST.value -> FIRST
SECOND.value -> SECOND
else -> null
}
}
@JvmField
val TO_STRING = { value: Property -> toString(value) }
@JvmField
val FROM_STRING = { value: String -> fromString(value) }
}
}
}