Created
February 18, 2016 13:46
-
-
Save sebprunier/01b0ecd22609b8398e02 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
package com.hubshare.services.users; | |
public class User { | |
private String login; | |
private String firstname; | |
private String lastname; | |
private String encryptedPassword; | |
private User(Builder builder) { | |
login = builder.login; | |
firstname = builder.firstname; | |
lastname = builder.lastname; | |
encryptedPassword = builder.encryptedPassword; | |
} | |
public static Builder newBuilder() { | |
return new Builder(); | |
} | |
public static Builder newBuilder(User copy) { | |
Builder builder = new Builder(); | |
builder.login = copy.login; | |
builder.firstname = copy.firstname; | |
builder.lastname = copy.lastname; | |
builder.encryptedPassword = copy.encryptedPassword; | |
return builder; | |
} | |
public String login() { | |
return login; | |
} | |
public String firstname() { | |
return firstname; | |
} | |
public String lastname() { | |
return lastname; | |
} | |
public String encryptedPassword() { | |
return encryptedPassword; | |
} | |
public static final class Builder { | |
private String login; | |
private String firstname; | |
private String lastname; | |
private String encryptedPassword; | |
private Builder() { | |
} | |
public Builder withLogin(String val) { | |
login = val; | |
return this; | |
} | |
public Builder withFirstname(String val) { | |
firstname = val; | |
return this; | |
} | |
public Builder withLastname(String val) { | |
lastname = val; | |
return this; | |
} | |
public Builder withEncryptedPassword(String val) { | |
encryptedPassword = val; | |
return this; | |
} | |
public User build() { | |
return new User(this); | |
} | |
} | |
} |
mathieuancelin
commented
Feb 18, 2016
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment