1 package au.gov.amsa.ais.router.model; 2 3 import com.github.davidmoten.guavamini.Preconditions; 4 5 public final class Authentication { 6 7 private final String username; 8 private final String password; 9 10 private Authentication(String username, String password) { 11 Preconditions.checkNotNull(username); 12 Preconditions.checkNotNull(password); 13 this.username = username; 14 this.password = password; 15 } 16 17 public String username() { 18 return username; 19 } 20 21 public String password() { 22 return password; 23 } 24 25 public static Builder builder() { 26 return new Builder(); 27 } 28 29 public static class Builder { 30 31 private String username; 32 private String password; 33 34 private Builder() { 35 } 36 37 public Builder username(String username) { 38 this.username = username; 39 return this; 40 } 41 42 public Builder password(String password) { 43 this.password = password; 44 return this; 45 } 46 47 public Authentication build() { 48 return new Authentication(username, password); 49 } 50 } 51 }