What we have so far, however, is still not going to satisfy our requirements regarding what every Person object should have initialized. We would have to change some methods in the PersonBuilder class. These methods are setFirstName, setLastName, and build. Here are the changes to the set methods:
def setFirstName(firstName: String): PersonBuilder[HasFirstName] = { this.firstName = firstName new PersonBuilder[HasFirstName](this)}def setLastName(lastName: String): PersonBuilder[HasLastName] = { this.lastName = lastName new PersonBuilder[HasLastName](this)}
The interesting part comes with the build method. Let's have a look at the following initial implementation:
def build()(implicit ...