From: Mateusz Warowny Date: Mon, 8 May 2023 14:25:29 +0000 (+0200) Subject: JAL-3954 Create getters for Credentials record X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=bdf95f93f6850d193260b0cb89b6322c7f280e63;p=jalview.git JAL-3954 Create getters for Credentials record --- diff --git a/src/jalview/ws2/api/Credentials.java b/src/jalview/ws2/api/Credentials.java index cc7c714..5e482ab 100644 --- a/src/jalview/ws2/api/Credentials.java +++ b/src/jalview/ws2/api/Credentials.java @@ -5,19 +5,39 @@ import java.util.Objects; public final class Credentials { String username = null; + String email = null; + String password = null; + private static final Credentials EMPTY = new Credentials(); - private Credentials() { + private Credentials() + { + } + + public String getUsername() + { + return username; + } + + public String getEmail() + { + return email; } - + + public String getPassword() + { + return password; + } + public static final Credentials empty() { return EMPTY; } - public static final Credentials usingEmail(String email) { + public static final Credentials usingEmail(String email) + { Objects.requireNonNull(email); if (email.isEmpty()) throw new IllegalArgumentException("empty email"); @@ -25,8 +45,9 @@ public final class Credentials credentials.email = email; return credentials; } - - public static final Credentials usingEmail(String email, String password) { + + public static final Credentials usingEmail(String email, String password) + { Objects.requireNonNull(email); Objects.requireNonNull(password); if (email.isEmpty()) @@ -36,8 +57,10 @@ public final class Credentials credentials.password = password; return credentials; } - - public static final Credentials usingUsername(String username, String password) { + + public static final Credentials usingUsername(String username, + String password) + { Objects.requireNonNull(username); Objects.requireNonNull(password); if (username.isEmpty())