Skip to content

Commit

Permalink
Merge pull request #31378 from vespa-engine/bjorncs/user
Browse files Browse the repository at this point in the history
Take overload taking existing instance
  • Loading branch information
Harald Musum authored May 31, 2024
2 parents e06242c + a36f48e commit c206180
Showing 1 changed file with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ private User(Builder builder) {
}

public static Builder builder() { return new Builder(); }
public static Builder builder(User u) { return new Builder(u); }

public static class Builder {
private String email;
Expand All @@ -48,6 +49,17 @@ public static class Builder {

private Builder() {}

private Builder(User u) {
email = u.email;
name = u.name;
nickname = u.nickname;
picture = u.picture;
isVerified = u.isVerified;
loginCount = u.loginCount;
lastLogin = u.lastLogin;
extraAttributes.putAll(u.extraAttributes);
}

public Builder email(String email) { this.email = email; return this; }
public Builder name(String name) { this.name = name; return this; }
public Builder nickname(String nickname) { this.nickname = nickname; return this; }
Expand Down

0 comments on commit c206180

Please sign in to comment.