toString

override fun toString(): String

Returns the string representation of this email address.


Calling from Kotlin

Here's an example of calling this function from Kotlin code:

val text = "[email protected]"
val emailAddress: EmailAddress = EmailAddress.of(text) ?: fail()
val result = "$emailAddress" // or emailAddress.toString()
assertEquals(expected = text, result)

Calling from Java

Here's an example of calling this function from Java code:

final String text = "[email protected]";
final EmailAddress address = EmailAddress.of(text);
Assertions.assertNotNull(address);
final String actual = address.toString();
Assertions.assertEquals(text, actual);