1 package jalview.ws2.api;
3 import java.util.Objects;
5 public final class Credentials
7 String username = null;
9 String password = null;
10 private static final Credentials EMPTY = new Credentials();
12 private Credentials() {
15 public static final Credentials empty()
20 public static final Credentials usingEmail(String email) {
21 Objects.requireNonNull(email);
23 throw new IllegalArgumentException("empty email");
24 Credentials credentials = new Credentials();
25 credentials.email = email;
29 public static final Credentials usingEmail(String email, String password) {
30 Objects.requireNonNull(email);
31 Objects.requireNonNull(password);
33 throw new IllegalArgumentException("empty email");
34 Credentials credentials = new Credentials();
35 credentials.email = email;
36 credentials.password = password;
40 public static final Credentials usingUsername(String username, String password) {
41 Objects.requireNonNull(username);
42 Objects.requireNonNull(password);
43 if (username.isEmpty())
44 throw new IllegalArgumentException("empty username");
45 Credentials credentials = new Credentials();
46 credentials.username = username;
47 credentials.password = password;