Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class SocialUserMapDot extends SocialUser {
- private int id;
- private String userName;
- private String firstName;
- private String lastName;
- private String role;
- private SocialNetwork socialNetwork;
- public SocialUserMapDot(String username, String password, Collection<? extends GrantedAuthority> authorities) {
- super(username, password, authorities);
- }
- public static Builder getBuilder() {
- return new Builder();
- }
- public int getId() {
- return id;
- }
- public String getUserName() {
- return userName;
- }
- public String getFirstName() {
- return firstName;
- }
- public String getLastName() {
- return lastName;
- }
- public String getRole() {
- return role;
- }
- public SocialNetwork getSocialNetwork() {
- return socialNetwork;
- }
- public static class Builder {
- private int id;
- private String userName;
- private String firstName;
- private String lastName;
- private String password;
- private String role;
- private SocialNetwork socialNetwork;
- private Set<GrantedAuthority> authorities;
- public Builder() {
- this.authorities = new HashSet<>();
- }
- public Builder id(int id) {
- this.id = id;
- return this;
- }
- public Builder userName(String userName) {
- this.userName = userName;
- return this;
- }
- public Builder firstName(String firstName) {
- this.firstName = firstName;
- return this;
- }
- public Builder lastName(String lastName) {
- this.lastName = lastName;
- return this;
- }
- public Builder password(String password) {
- if (password == null) {
- password = "SocialUser";
- }
- this.password = password;
- return this;
- }
- public Builder role(String role) {
- this.role = role;
- SimpleGrantedAuthority authority = new SimpleGrantedAuthority(role);
- this.authorities.add(authority);
- return this;
- }
- public Builder socialNetwork(SocialNetwork socialNetwork) {
- this.socialNetwork = socialNetwork;
- return this;
- }
- public SocialUserMapDot build() {
- SocialUserMapDot socialUserMapDot = new SocialUserMapDot(userName, password, authorities);
- this.id = id;
- this.firstName = firstName;
- this.lastName = lastName;
- this.password = password;
- this.role = role;
- this.socialNetwork = socialNetwork;
- return socialUserMapDot;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement