com.lithic.api.models.ExternalBankAccountAddress.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of lithic-java-core Show documentation
Show all versions of lithic-java-core Show documentation
The Lithic Developer API is designed to provide a predictable programmatic
interface for accessing your Lithic account through an API and transaction
webhooks. Note that your API key is a secret and should be treated as such.
Don't share it with anyone, including us. We will never ask you for it.
// File generated from our OpenAPI spec by Stainless.
package com.lithic.api.models
import com.fasterxml.jackson.annotation.JsonAnyGetter
import com.fasterxml.jackson.annotation.JsonAnySetter
import com.fasterxml.jackson.annotation.JsonProperty
import com.fasterxml.jackson.databind.annotation.JsonDeserialize
import com.lithic.api.core.ExcludeMissing
import com.lithic.api.core.JsonField
import com.lithic.api.core.JsonMissing
import com.lithic.api.core.JsonValue
import com.lithic.api.core.NoAutoDetect
import com.lithic.api.core.toUnmodifiable
import java.util.Objects
import java.util.Optional
@JsonDeserialize(builder = ExternalBankAccountAddress.Builder::class)
@NoAutoDetect
class ExternalBankAccountAddress
private constructor(
private val address1: JsonField,
private val address2: JsonField,
private val city: JsonField,
private val state: JsonField,
private val postalCode: JsonField,
private val country: JsonField,
private val additionalProperties: Map,
) {
private var validated: Boolean = false
fun address1(): String = address1.getRequired("address1")
fun address2(): Optional = Optional.ofNullable(address2.getNullable("address2"))
fun city(): String = city.getRequired("city")
fun state(): String = state.getRequired("state")
fun postalCode(): String = postalCode.getRequired("postal_code")
fun country(): String = country.getRequired("country")
@JsonProperty("address1") @ExcludeMissing fun _address1() = address1
@JsonProperty("address2") @ExcludeMissing fun _address2() = address2
@JsonProperty("city") @ExcludeMissing fun _city() = city
@JsonProperty("state") @ExcludeMissing fun _state() = state
@JsonProperty("postal_code") @ExcludeMissing fun _postalCode() = postalCode
@JsonProperty("country") @ExcludeMissing fun _country() = country
@JsonAnyGetter
@ExcludeMissing
fun _additionalProperties(): Map = additionalProperties
fun validate(): ExternalBankAccountAddress = apply {
if (!validated) {
address1()
address2()
city()
state()
postalCode()
country()
validated = true
}
}
fun toBuilder() = Builder().from(this)
companion object {
@JvmStatic fun builder() = Builder()
}
class Builder {
private var address1: JsonField = JsonMissing.of()
private var address2: JsonField = JsonMissing.of()
private var city: JsonField = JsonMissing.of()
private var state: JsonField = JsonMissing.of()
private var postalCode: JsonField = JsonMissing.of()
private var country: JsonField = JsonMissing.of()
private var additionalProperties: MutableMap = mutableMapOf()
@JvmSynthetic
internal fun from(externalBankAccountAddress: ExternalBankAccountAddress) = apply {
this.address1 = externalBankAccountAddress.address1
this.address2 = externalBankAccountAddress.address2
this.city = externalBankAccountAddress.city
this.state = externalBankAccountAddress.state
this.postalCode = externalBankAccountAddress.postalCode
this.country = externalBankAccountAddress.country
additionalProperties(externalBankAccountAddress.additionalProperties)
}
fun address1(address1: String) = address1(JsonField.of(address1))
@JsonProperty("address1")
@ExcludeMissing
fun address1(address1: JsonField) = apply { this.address1 = address1 }
fun address2(address2: String) = address2(JsonField.of(address2))
@JsonProperty("address2")
@ExcludeMissing
fun address2(address2: JsonField) = apply { this.address2 = address2 }
fun city(city: String) = city(JsonField.of(city))
@JsonProperty("city")
@ExcludeMissing
fun city(city: JsonField) = apply { this.city = city }
fun state(state: String) = state(JsonField.of(state))
@JsonProperty("state")
@ExcludeMissing
fun state(state: JsonField) = apply { this.state = state }
fun postalCode(postalCode: String) = postalCode(JsonField.of(postalCode))
@JsonProperty("postal_code")
@ExcludeMissing
fun postalCode(postalCode: JsonField) = apply { this.postalCode = postalCode }
fun country(country: String) = country(JsonField.of(country))
@JsonProperty("country")
@ExcludeMissing
fun country(country: JsonField) = apply { this.country = country }
fun additionalProperties(additionalProperties: Map) = apply {
this.additionalProperties.clear()
this.additionalProperties.putAll(additionalProperties)
}
@JsonAnySetter
fun putAdditionalProperty(key: String, value: JsonValue) = apply {
this.additionalProperties.put(key, value)
}
fun putAllAdditionalProperties(additionalProperties: Map) = apply {
this.additionalProperties.putAll(additionalProperties)
}
fun build(): ExternalBankAccountAddress =
ExternalBankAccountAddress(
address1,
address2,
city,
state,
postalCode,
country,
additionalProperties.toUnmodifiable(),
)
}
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}
return other is ExternalBankAccountAddress &&
this.address1 == other.address1 &&
this.address2 == other.address2 &&
this.city == other.city &&
this.state == other.state &&
this.postalCode == other.postalCode &&
this.country == other.country &&
this.additionalProperties == other.additionalProperties
}
private var hashCode: Int = 0
override fun hashCode(): Int {
if (hashCode == 0) {
hashCode =
Objects.hash(
address1,
address2,
city,
state,
postalCode,
country,
additionalProperties,
)
}
return hashCode
}
override fun toString() =
"ExternalBankAccountAddress{address1=$address1, address2=$address2, city=$city, state=$state, postalCode=$postalCode, country=$country, additionalProperties=$additionalProperties}"
}