You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
65 lines
1.5 KiB
Java
65 lines
1.5 KiB
Java
package eu.eudat.logic.builders.model.models;
|
|
|
|
import eu.eudat.logic.builders.Builder;
|
|
import eu.eudat.models.data.security.Principal;
|
|
import eu.eudat.types.Authorities;
|
|
|
|
import java.util.Date;
|
|
import java.util.Set;
|
|
import java.util.UUID;
|
|
|
|
/**
|
|
* Created by ikalyvas on 2/15/2018.
|
|
*/
|
|
public class PrincipalBuilder extends Builder<Principal> {
|
|
|
|
private UUID id;
|
|
private UUID token;
|
|
private String name;
|
|
private Date expiresAt;
|
|
private String avatarUrl;
|
|
private Set<Authorities> authorities;
|
|
|
|
public PrincipalBuilder id(UUID id) {
|
|
this.id = id;
|
|
return this;
|
|
}
|
|
|
|
public PrincipalBuilder token(UUID token) {
|
|
this.token = token;
|
|
return this;
|
|
}
|
|
|
|
public PrincipalBuilder name(String name) {
|
|
this.name = name;
|
|
return this;
|
|
}
|
|
|
|
public PrincipalBuilder expiresAt(Date expiresAt) {
|
|
this.expiresAt = expiresAt;
|
|
return this;
|
|
}
|
|
|
|
public PrincipalBuilder authorities(Set<Authorities> authorities) {
|
|
this.authorities = authorities;
|
|
return this;
|
|
}
|
|
|
|
public PrincipalBuilder avatarUrl(String avatarUrl) {
|
|
this.avatarUrl = avatarUrl;
|
|
return this;
|
|
}
|
|
|
|
@Override
|
|
public Principal build() {
|
|
Principal principal = new Principal();
|
|
principal.setAuthorities(authorities);
|
|
principal.setName(name);
|
|
principal.setExpiresAt(expiresAt);
|
|
principal.setToken(token);
|
|
principal.setId(id);
|
|
principal.setAvatarUrl(avatarUrl);
|
|
return principal;
|
|
}
|
|
}
|