From a36f48e93027442e7a28f2d588c5f22f3ee734e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Christian=20Seime?= Date: Fri, 31 May 2024 14:06:37 +0200 Subject: [PATCH] Take overload taking existing instance --- .../yahoo/jdisc/http/filter/security/misc/User.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/jdisc-security-filters/src/main/java/com/yahoo/jdisc/http/filter/security/misc/User.java b/jdisc-security-filters/src/main/java/com/yahoo/jdisc/http/filter/security/misc/User.java index 607e3482c3d2..616b9df4bd85 100644 --- a/jdisc-security-filters/src/main/java/com/yahoo/jdisc/http/filter/security/misc/User.java +++ b/jdisc-security-filters/src/main/java/com/yahoo/jdisc/http/filter/security/misc/User.java @@ -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; @@ -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; }