Last active
August 29, 2015 13:57
-
-
Save jeffwf/9629861 to your computer and use it in GitHub Desktop.
This file contains 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
@Entity | |
public class Person { | |
@Value | |
private String firstName; | |
@Value | |
private String middleName; | |
@Value | |
private String lastName; | |
Person() {} | |
public Person( | |
String firstName, | |
Optional<String> middleName, | |
String lastName) { | |
Objects.requireNonNull(firstName); | |
Objects.requireNonNull(lastName); | |
this.firstName = firstName; | |
this.middleName = middleName.orNull(); | |
this.lastName = lastName; | |
} | |
public String getFirstName() { | |
return firstName; | |
} | |
public Optional<String> getMiddleName() { | |
return Optional.fromNullable(middleName); | |
} | |
public String getLastName() { | |
return lastName; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment