Skip to content

Instantly share code, notes, and snippets.

@FriendlyTester
Last active August 29, 2015 14:23
Show Gist options
  • Save FriendlyTester/70e39dab19f1260a20e3 to your computer and use it in GitHub Desktop.
Save FriendlyTester/70e39dab19f1260a20e3 to your computer and use it in GitHub Desktop.
A simple model for demonstrating the data builder pattern
public class User
{
private String firstName;
private String surname;
private int age;
private String emailAddress;
}
//Then you could do the following
public void setFirstName(String firstName)
{
firstName = firstName;
}
//Repeating for all the properties.
//Most IDEs will auto generate this for you now adays
//Or if you are using Java, you could take advantage of lombok, https://github.com/rzwitserloot/lombok
//Would look something like this
@Getter @Setter
private String firstName
//lombok would then create the getters and setters for you.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment