Created
December 18, 2019 14:27
-
-
Save ababup1192/268e137a24fd1e40eb11f03e259c0079 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
case class LastName private (value: String) extends AnyVal | |
object LastName { | |
private[this] val maxLength = 32 | |
def apply(value: String): LastName = { | |
val trimmed = value.trim | |
require(!trimmed.isEmpty && trimmed.length <= maxLength) | |
new LastName(trimmed) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment