/** * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be * redacted from this string using a placeholder value. */ @Override public String toString() { return ToString.builder("ConfirmForgotPasswordRequest") .add("ClientId", clientId() == null ? null : "*** Sensitive Data Redacted ***") .add("SecretHash", secretHash() == null ? null : "*** Sensitive Data Redacted ***") .add("Username", username() == null ? null : "*** Sensitive Data Redacted ***") .add("ConfirmationCode", confirmationCode()) .add("Password", password() == null ? null : "*** Sensitive Data Redacted ***") .add("AnalyticsMetadata", analyticsMetadata()).add("UserContextData", userContextData()).build(); }
@Override public int hashCode() { int hashCode = 1; hashCode = 31 * hashCode + Objects.hashCode(clientId()); hashCode = 31 * hashCode + Objects.hashCode(secretHash()); hashCode = 31 * hashCode + Objects.hashCode(username()); hashCode = 31 * hashCode + Objects.hashCode(confirmationCode()); hashCode = 31 * hashCode + Objects.hashCode(password()); hashCode = 31 * hashCode + Objects.hashCode(analyticsMetadata()); hashCode = 31 * hashCode + Objects.hashCode(userContextData()); return hashCode; }
public <T> Optional<T> getValueForField(String fieldName, Class<T> clazz) { switch (fieldName) { case "ClientId": return Optional.ofNullable(clazz.cast(clientId())); case "SecretHash": return Optional.ofNullable(clazz.cast(secretHash())); case "Username": return Optional.ofNullable(clazz.cast(username())); case "ConfirmationCode": return Optional.ofNullable(clazz.cast(confirmationCode())); case "Password": return Optional.ofNullable(clazz.cast(password())); case "AnalyticsMetadata": return Optional.ofNullable(clazz.cast(analyticsMetadata())); case "UserContextData": return Optional.ofNullable(clazz.cast(userContextData())); default: return Optional.empty(); } }
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof ConfirmForgotPasswordRequest)) { return false; } ConfirmForgotPasswordRequest other = (ConfirmForgotPasswordRequest) obj; return Objects.equals(clientId(), other.clientId()) && Objects.equals(secretHash(), other.secretHash()) && Objects.equals(username(), other.username()) && Objects.equals(confirmationCode(), other.confirmationCode()) && Objects.equals(password(), other.password()) && Objects.equals(analyticsMetadata(), other.analyticsMetadata()) && Objects.equals(userContextData(), other.userContextData()); }