-
-
Save Passarinho4/0191adc05e5b9fa57766677a22c84545 to your computer and use it in GitHub Desktop.
Abstract builder
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
public static abstract class Builder<T> { | |
private String name; | |
private String surname; | |
private String email; | |
private String nationality; | |
private Sex sex; | |
private String academy; | |
private Role role; | |
public Builder<T> sex(Sex sex) { | |
this.sex = sex; | |
return this; | |
} | |
public Builder<T> academy(String academy) { | |
this.academy = academy; | |
return this; | |
} | |
public Builder<T> role(Role role) { | |
this.role = role; | |
return this; | |
} | |
public void setName(String name) { | |
this.name = name; | |
} | |
public void setSurname(String surname) { | |
this.surname = surname; | |
} | |
public void setEmail(String email) { | |
this.email = email; | |
} | |
public void setNationality(String nationality) { | |
this.nationality = nationality; | |
} | |
public abstract T build(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment