All Downloads are FREE. Search and download functionalities are using the official Maven repository.

software.amazon.awssdk.services.support.model.AttachmentDetails 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.support.model;

import java.beans.Transient;
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 file name and ID of an attachment to a case communication. You can use the ID to retrieve the attachment with the * DescribeAttachment operation. *

*/ @Generated("software.amazon.awssdk:codegen") public final class AttachmentDetails implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField ATTACHMENT_ID_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("attachmentId").getter(getter(AttachmentDetails::attachmentId)).setter(setter(Builder::attachmentId)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("attachmentId").build()).build(); private static final SdkField FILE_NAME_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("fileName").getter(getter(AttachmentDetails::fileName)).setter(setter(Builder::fileName)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("fileName").build()).build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(ATTACHMENT_ID_FIELD, FILE_NAME_FIELD)); private static final long serialVersionUID = 1L; private final String attachmentId; private final String fileName; private AttachmentDetails(BuilderImpl builder) { this.attachmentId = builder.attachmentId; this.fileName = builder.fileName; } /** *

* The ID of the attachment. *

* * @return The ID of the attachment. */ public final String attachmentId() { return attachmentId; } /** *

* The file name of the attachment. *

* * @return The file name of the attachment. */ public final String fileName() { return fileName; } @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(attachmentId()); hashCode = 31 * hashCode + Objects.hashCode(fileName()); 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 AttachmentDetails)) { return false; } AttachmentDetails other = (AttachmentDetails) obj; return Objects.equals(attachmentId(), other.attachmentId()) && Objects.equals(fileName(), other.fileName()); } /** * 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("AttachmentDetails").add("AttachmentId", attachmentId()).add("FileName", fileName()).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "attachmentId": return Optional.ofNullable(clazz.cast(attachmentId())); case "fileName": return Optional.ofNullable(clazz.cast(fileName())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((AttachmentDetails) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* The ID of the attachment. *

* * @param attachmentId * The ID of the attachment. * @return Returns a reference to this object so that method calls can be chained together. */ Builder attachmentId(String attachmentId); /** *

* The file name of the attachment. *

* * @param fileName * The file name of the attachment. * @return Returns a reference to this object so that method calls can be chained together. */ Builder fileName(String fileName); } static final class BuilderImpl implements Builder { private String attachmentId; private String fileName; private BuilderImpl() { } private BuilderImpl(AttachmentDetails model) { attachmentId(model.attachmentId); fileName(model.fileName); } public final String getAttachmentId() { return attachmentId; } public final void setAttachmentId(String attachmentId) { this.attachmentId = attachmentId; } @Override @Transient public final Builder attachmentId(String attachmentId) { this.attachmentId = attachmentId; return this; } public final String getFileName() { return fileName; } public final void setFileName(String fileName) { this.fileName = fileName; } @Override @Transient public final Builder fileName(String fileName) { this.fileName = fileName; return this; } @Override public AttachmentDetails build() { return new AttachmentDetails(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy