Files
divkit/api_generator/tests/references/shared_data_kotlin/EntityWithPropertyWithDefaultValue.kt
T
gulevsky c9caf87860 add code generation of json serializers
commit_hash:3ad603b95c6c6ead4feaa591da3fbe2e91751455
2024-09-25 12:55:58 +03:00

97 lines
3.2 KiB
Kotlin

// Generated code. Do not modify.
package com.yandex.div.reference
import org.json.JSONArray
import org.json.JSONObject
class EntityWithPropertyWithDefaultValue(
@JvmField val int: Expression<Long> = INT_DEFAULT_VALUE, // constraint: number >= 0; default value: 0
@JvmField val nested: Nested? = null,
@JvmField val url: Expression<Uri> = URL_DEFAULT_VALUE, // valid schemes: [https]; default value: https://yandex.ru
) : Hashable {
private var _hash: Int? = null
override fun hash(): Int {
_hash?.let {
return it
}
val hash =
this::class.hashCode() +
int.hashCode() +
(nested?.hash() ?: 0) +
url.hashCode()
_hash = hash
return hash
}
fun equals(other: EntityWithPropertyWithDefaultValue?, resolver: ExpressionResolver, otherResolver: ExpressionResolver): Boolean {
other ?: return false
return int.evaluate(resolver) == other.int.evaluate(otherResolver) &&
(nested?.equals(other.nested, resolver, otherResolver) ?: (other.nested == null)) &&
url.evaluate(resolver) == other.url.evaluate(otherResolver)
}
fun copy(
int: Expression<Long> = this.int,
nested: Nested? = this.nested,
url: Expression<Uri> = this.url,
) = EntityWithPropertyWithDefaultValue(
int = int,
nested = nested,
url = url,
)
companion object {
const val TYPE = "entity_with_property_with_default_value"
private val INT_DEFAULT_VALUE = Expression.constant(0L)
private val URL_DEFAULT_VALUE = Expression.constant(Uri.parse("https://yandex.ru"))
}
class Nested(
@JvmField val int: Expression<Long> = INT_DEFAULT_VALUE, // constraint: number >= 0; default value: 0
@JvmField val nonOptional: Expression<String>,
@JvmField val url: Expression<Uri> = URL_DEFAULT_VALUE, // valid schemes: [https]; default value: https://yandex.ru
) : Hashable {
private var _hash: Int? = null
override fun hash(): Int {
_hash?.let {
return it
}
val hash =
this::class.hashCode() +
int.hashCode() +
nonOptional.hashCode() +
url.hashCode()
_hash = hash
return hash
}
fun equals(other: Nested?, resolver: ExpressionResolver, otherResolver: ExpressionResolver): Boolean {
other ?: return false
return int.evaluate(resolver) == other.int.evaluate(otherResolver) &&
nonOptional.evaluate(resolver) == other.nonOptional.evaluate(otherResolver) &&
url.evaluate(resolver) == other.url.evaluate(otherResolver)
}
fun copy(
int: Expression<Long> = this.int,
nonOptional: Expression<String> = this.nonOptional,
url: Expression<Uri> = this.url,
) = Nested(
int = int,
nonOptional = nonOptional,
url = url,
)
companion object {
private val INT_DEFAULT_VALUE = Expression.constant(0L)
private val URL_DEFAULT_VALUE = Expression.constant(Uri.parse("https://yandex.ru"))
}
}
}