Last active
August 29, 2015 14:23
-
-
Save FriendlyTester/ce3f55a9595b2bd2ec99 to your computer and use it in GitHub Desktop.
AndrewGist
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 class UserBuilder | |
{ | |
private User; | |
public UserBuilder() | |
{ | |
User = new User(); | |
user.setFirstName("Richard"); | |
user.setSurname("Bradshaw"); | |
user.setAge(29); | |
user.setEmailAddress("[email protected]"); | |
} | |
public User buildGenericUser() | |
{ | |
return User; | |
} | |
public User buildOAPUser() | |
{ | |
user.setAge(66); | |
return User; | |
} | |
public User buildTeenageUser() | |
{ | |
user.setAge(66); | |
return User; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I would "return this;" in User class methods, so you could build the data object like this:
user
.setFirstName("Richard")
.setSurName("Bradshaw")
.setAge(29);
Looks cleaner in my point of view.