Last active
January 3, 2021 16:07
-
-
Save lucapiccinelli/c154f871dcfc09e5ace0d37ce15807a2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data class ContactInfo( | |
val name: PersonalName, | |
val email: Email) | |
data class PersonalName( | |
val firstname: NotEmptyString, | |
val middleInitial: NotEmptyString?, | |
val lastname: NotEmptyString){ | |
... // construction code here | |
} | |
sealed class Email(val value: String){ | |
data class Verified(private val email: Unverified): Email(email.value) | |
class Unverified private constructor(value: String): Email(value){ | |
... // construction code here | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment