EmailAddress

@ExperimentalSince(version = KotoolsTypesVersion.V4_4_0)
@Serializable(with = EmailAddressSerializer::class)
class EmailAddress

Represents an email address.

You can use the EmailAddress.Companion.create or the EmailAddress.Companion.createOrNull functions for creating an instance of this type.


Serialization and deserialization

The serialization and deserialization processes of this type behave like for the String type.

Here's an example of Kotlin code that encodes and decodes this type using the JavaScript Object Notation (JSON) format from kotlinx.serialization:

val address: EmailAddress = EmailAddress.create("[email protected]")
val encoded: String = Json.encodeToString(address)
println(encoded) // "[email protected]"
val decoded: EmailAddress = Json.decodeFromString(encoded)
println(decoded == address) // true

Types

Link copied to clipboard
object Companion

Contains static declarations for the EmailAddress type.

Functions

Link copied to clipboard
operator override fun equals(other: Any?): Boolean

Returns true if the other object is an EmailAddress having the same string representation as this email address, or returns false otherwise.

Link copied to clipboard
override fun hashCode(): Int

Returns a hash code value for this email address.

Link copied to clipboard
override fun toString(): String

Returns the string representation of this email address.