Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Person {
- protected String name;
- protected int age;
- protected String login;
- protected String password;
- public Person(PersonBuilder personBuilder) {
- this.name = personBuilder.name;
- this.age = personBuilder.age;
- this.login = personBuilder.login;
- this.password = personBuilder.password;
- }
- public static class PersonBuilder {
- protected String name;
- protected int age;
- protected String login;
- protected String password;
- public PersonBuilder(){
- super();
- }
- public PersonBuilder name(String name){
- this.name = name;
- return this;
- }
- public PersonBuilder age(int age){
- this.age = age;
- return this;
- }
- public PersonBuilder login(String login){
- this.login = login;
- return this;
- }
- public PersonBuilder password(String password){
- this.password = password;
- return this;
- }
- public Person build(){
- Person person = null;
- person = new Person(this);
- return person;
- }
- }
- public String getName() {
- return name;
- }
- public void setName(String name) {
- this.name = name;
- }
- public int getAge() {
- return age;
- }
- public void setAge(int age) {
- this.age = age;
- }
- public String getLogin() {
- return login;
- }
- public void setLogin(String login) {
- this.login = login;
- }
- public String getPassword() {
- return password;
- }
- public void setPassword(String password) {
- this.password = password;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement