/** * 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("GetUserResponse").add("Username", username() == null ? null : "*** Sensitive Data Redacted ***") .add("UserAttributes", userAttributes()).add("MFAOptions", mfaOptions()) .add("PreferredMfaSetting", preferredMfaSetting()).add("UserMFASettingList", userMFASettingList()).build(); }
@Override public int hashCode() { int hashCode = 1; hashCode = 31 * hashCode + Objects.hashCode(username()); hashCode = 31 * hashCode + Objects.hashCode(userAttributes()); hashCode = 31 * hashCode + Objects.hashCode(mfaOptions()); hashCode = 31 * hashCode + Objects.hashCode(preferredMfaSetting()); hashCode = 31 * hashCode + Objects.hashCode(userMFASettingList()); return hashCode; }
public <T> Optional<T> getValueForField(String fieldName, Class<T> clazz) { switch (fieldName) { case "Username": return Optional.ofNullable(clazz.cast(username())); case "UserAttributes": return Optional.ofNullable(clazz.cast(userAttributes())); case "MFAOptions": return Optional.ofNullable(clazz.cast(mfaOptions())); case "PreferredMfaSetting": return Optional.ofNullable(clazz.cast(preferredMfaSetting())); case "UserMFASettingList": return Optional.ofNullable(clazz.cast(userMFASettingList())); default: return Optional.empty(); } }
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof GetUserResponse)) { return false; } GetUserResponse other = (GetUserResponse) obj; return Objects.equals(username(), other.username()) && Objects.equals(userAttributes(), other.userAttributes()) && Objects.equals(mfaOptions(), other.mfaOptions()) && Objects.equals(preferredMfaSetting(), other.preferredMfaSetting()) && Objects.equals(userMFASettingList(), other.userMFASettingList()); }