software.amazon.awssdk.services.account.model.AlternateContact Maven / Gradle / Ivy
Show all versions of account Show documentation
/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package software.amazon.awssdk.services.account.model;
import java.io.Serializable;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.function.BiConsumer;
import java.util.function.Function;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.core.SdkField;
import software.amazon.awssdk.core.SdkPojo;
import software.amazon.awssdk.core.protocol.MarshallLocation;
import software.amazon.awssdk.core.protocol.MarshallingType;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* A structure that contains the details of an alternate contact associated with an Amazon Web Services account
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class AlternateContact implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField ALTERNATE_CONTACT_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("AlternateContactType").getter(getter(AlternateContact::alternateContactTypeAsString))
.setter(setter(Builder::alternateContactType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AlternateContactType").build())
.build();
private static final SdkField EMAIL_ADDRESS_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("EmailAddress").getter(getter(AlternateContact::emailAddress)).setter(setter(Builder::emailAddress))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("EmailAddress").build()).build();
private static final SdkField NAME_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Name")
.getter(getter(AlternateContact::name)).setter(setter(Builder::name))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Name").build()).build();
private static final SdkField PHONE_NUMBER_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("PhoneNumber").getter(getter(AlternateContact::phoneNumber)).setter(setter(Builder::phoneNumber))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("PhoneNumber").build()).build();
private static final SdkField TITLE_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Title")
.getter(getter(AlternateContact::title)).setter(setter(Builder::title))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Title").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(ALTERNATE_CONTACT_TYPE_FIELD,
EMAIL_ADDRESS_FIELD, NAME_FIELD, PHONE_NUMBER_FIELD, TITLE_FIELD));
private static final long serialVersionUID = 1L;
private final String alternateContactType;
private final String emailAddress;
private final String name;
private final String phoneNumber;
private final String title;
private AlternateContact(BuilderImpl builder) {
this.alternateContactType = builder.alternateContactType;
this.emailAddress = builder.emailAddress;
this.name = builder.name;
this.phoneNumber = builder.phoneNumber;
this.title = builder.title;
}
/**
*
* The type of alternate contact.
*
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #alternateContactType} will return {@link AlternateContactType#UNKNOWN_TO_SDK_VERSION}. The raw value
* returned by the service is available from {@link #alternateContactTypeAsString}.
*
*
* @return The type of alternate contact.
* @see AlternateContactType
*/
public final AlternateContactType alternateContactType() {
return AlternateContactType.fromValue(alternateContactType);
}
/**
*
* The type of alternate contact.
*
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #alternateContactType} will return {@link AlternateContactType#UNKNOWN_TO_SDK_VERSION}. The raw value
* returned by the service is available from {@link #alternateContactTypeAsString}.
*
*
* @return The type of alternate contact.
* @see AlternateContactType
*/
public final String alternateContactTypeAsString() {
return alternateContactType;
}
/**
*
* The email address associated with this alternate contact.
*
*
* @return The email address associated with this alternate contact.
*/
public final String emailAddress() {
return emailAddress;
}
/**
*
* The name associated with this alternate contact.
*
*
* @return The name associated with this alternate contact.
*/
public final String name() {
return name;
}
/**
*
* The phone number associated with this alternate contact.
*
*
* @return The phone number associated with this alternate contact.
*/
public final String phoneNumber() {
return phoneNumber;
}
/**
*
* The title associated with this alternate contact.
*
*
* @return The title associated with this alternate contact.
*/
public final String title() {
return title;
}
@Override
public Builder toBuilder() {
return new BuilderImpl(this);
}
public static Builder builder() {
return new BuilderImpl();
}
public static Class serializableBuilderClass() {
return BuilderImpl.class;
}
@Override
public final int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + Objects.hashCode(alternateContactTypeAsString());
hashCode = 31 * hashCode + Objects.hashCode(emailAddress());
hashCode = 31 * hashCode + Objects.hashCode(name());
hashCode = 31 * hashCode + Objects.hashCode(phoneNumber());
hashCode = 31 * hashCode + Objects.hashCode(title());
return hashCode;
}
@Override
public final boolean equals(Object obj) {
return equalsBySdkFields(obj);
}
@Override
public final boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof AlternateContact)) {
return false;
}
AlternateContact other = (AlternateContact) obj;
return Objects.equals(alternateContactTypeAsString(), other.alternateContactTypeAsString())
&& Objects.equals(emailAddress(), other.emailAddress()) && Objects.equals(name(), other.name())
&& Objects.equals(phoneNumber(), other.phoneNumber()) && Objects.equals(title(), other.title());
}
/**
* 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 final String toString() {
return ToString.builder("AlternateContact").add("AlternateContactType", alternateContactTypeAsString())
.add("EmailAddress", emailAddress() == null ? null : "*** Sensitive Data Redacted ***")
.add("Name", name() == null ? null : "*** Sensitive Data Redacted ***")
.add("PhoneNumber", phoneNumber() == null ? null : "*** Sensitive Data Redacted ***")
.add("Title", title() == null ? null : "*** Sensitive Data Redacted ***").build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "AlternateContactType":
return Optional.ofNullable(clazz.cast(alternateContactTypeAsString()));
case "EmailAddress":
return Optional.ofNullable(clazz.cast(emailAddress()));
case "Name":
return Optional.ofNullable(clazz.cast(name()));
case "PhoneNumber":
return Optional.ofNullable(clazz.cast(phoneNumber()));
case "Title":
return Optional.ofNullable(clazz.cast(title()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function