software.amazon.awssdk.services.workmail.model.OrganizationSummary Maven / Gradle / Ivy
/*
* 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.workmail.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;
/**
*
* The representation of an organization.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class OrganizationSummary implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField ORGANIZATION_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("OrganizationId").getter(getter(OrganizationSummary::organizationId))
.setter(setter(Builder::organizationId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("OrganizationId").build()).build();
private static final SdkField ALIAS_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Alias")
.getter(getter(OrganizationSummary::alias)).setter(setter(Builder::alias))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Alias").build()).build();
private static final SdkField DEFAULT_MAIL_DOMAIN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("DefaultMailDomain").getter(getter(OrganizationSummary::defaultMailDomain))
.setter(setter(Builder::defaultMailDomain))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DefaultMailDomain").build()).build();
private static final SdkField ERROR_MESSAGE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ErrorMessage").getter(getter(OrganizationSummary::errorMessage)).setter(setter(Builder::errorMessage))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ErrorMessage").build()).build();
private static final SdkField STATE_FIELD = SdkField. builder(MarshallingType.STRING).memberName("State")
.getter(getter(OrganizationSummary::state)).setter(setter(Builder::state))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("State").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(ORGANIZATION_ID_FIELD,
ALIAS_FIELD, DEFAULT_MAIL_DOMAIN_FIELD, ERROR_MESSAGE_FIELD, STATE_FIELD));
private static final long serialVersionUID = 1L;
private final String organizationId;
private final String alias;
private final String defaultMailDomain;
private final String errorMessage;
private final String state;
private OrganizationSummary(BuilderImpl builder) {
this.organizationId = builder.organizationId;
this.alias = builder.alias;
this.defaultMailDomain = builder.defaultMailDomain;
this.errorMessage = builder.errorMessage;
this.state = builder.state;
}
/**
*
* The identifier associated with the organization.
*
*
* @return The identifier associated with the organization.
*/
public final String organizationId() {
return organizationId;
}
/**
*
* The alias associated with the organization.
*
*
* @return The alias associated with the organization.
*/
public final String alias() {
return alias;
}
/**
*
* The default email domain associated with the organization.
*
*
* @return The default email domain associated with the organization.
*/
public final String defaultMailDomain() {
return defaultMailDomain;
}
/**
*
* The error message associated with the organization. It is only present if unexpected behavior has occurred with
* regards to the organization. It provides insight or solutions regarding unexpected behavior.
*
*
* @return The error message associated with the organization. It is only present if unexpected behavior has
* occurred with regards to the organization. It provides insight or solutions regarding unexpected
* behavior.
*/
public final String errorMessage() {
return errorMessage;
}
/**
*
* The state associated with the organization.
*
*
* @return The state associated with the organization.
*/
public final String state() {
return state;
}
@Override
public Builder toBuilder() {
return new BuilderImpl(this);
}
public static Builder builder() {
return new BuilderImpl();
}
public static Class extends Builder> serializableBuilderClass() {
return BuilderImpl.class;
}
@Override
public final int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + Objects.hashCode(organizationId());
hashCode = 31 * hashCode + Objects.hashCode(alias());
hashCode = 31 * hashCode + Objects.hashCode(defaultMailDomain());
hashCode = 31 * hashCode + Objects.hashCode(errorMessage());
hashCode = 31 * hashCode + Objects.hashCode(state());
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 OrganizationSummary)) {
return false;
}
OrganizationSummary other = (OrganizationSummary) obj;
return Objects.equals(organizationId(), other.organizationId()) && Objects.equals(alias(), other.alias())
&& Objects.equals(defaultMailDomain(), other.defaultMailDomain())
&& Objects.equals(errorMessage(), other.errorMessage()) && Objects.equals(state(), other.state());
}
/**
* 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("OrganizationSummary").add("OrganizationId", organizationId()).add("Alias", alias())
.add("DefaultMailDomain", defaultMailDomain()).add("ErrorMessage", errorMessage()).add("State", state()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "OrganizationId":
return Optional.ofNullable(clazz.cast(organizationId()));
case "Alias":
return Optional.ofNullable(clazz.cast(alias()));
case "DefaultMailDomain":
return Optional.ofNullable(clazz.cast(defaultMailDomain()));
case "ErrorMessage":
return Optional.ofNullable(clazz.cast(errorMessage()));
case "State":
return Optional.ofNullable(clazz.cast(state()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function