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

software.amazon.awssdk.services.ses.model.Template Maven / Gradle / Ivy

Go to download

The AWS Java SDK for Amazon SES module holds the client classes that are used for communicating with Amazon Simple Email Service

There is a newer version: 2.30.1
Show newest version
/*
 * 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.ses.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 content of the email, composed of a subject line, an HTML part, and a text-only part. *

*/ @Generated("software.amazon.awssdk:codegen") public final class Template implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField TEMPLATE_NAME_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("TemplateName").getter(getter(Template::templateName)).setter(setter(Builder::templateName)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TemplateName").build()).build(); private static final SdkField SUBJECT_PART_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("SubjectPart").getter(getter(Template::subjectPart)).setter(setter(Builder::subjectPart)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SubjectPart").build()).build(); private static final SdkField TEXT_PART_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("TextPart").getter(getter(Template::textPart)).setter(setter(Builder::textPart)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TextPart").build()).build(); private static final SdkField HTML_PART_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("HtmlPart").getter(getter(Template::htmlPart)).setter(setter(Builder::htmlPart)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("HtmlPart").build()).build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(TEMPLATE_NAME_FIELD, SUBJECT_PART_FIELD, TEXT_PART_FIELD, HTML_PART_FIELD)); private static final long serialVersionUID = 1L; private final String templateName; private final String subjectPart; private final String textPart; private final String htmlPart; private Template(BuilderImpl builder) { this.templateName = builder.templateName; this.subjectPart = builder.subjectPart; this.textPart = builder.textPart; this.htmlPart = builder.htmlPart; } /** *

* The name of the template. You will refer to this name when you send email using the * SendTemplatedEmail or SendBulkTemplatedEmail operations. *

* * @return The name of the template. You will refer to this name when you send email using the * SendTemplatedEmail or SendBulkTemplatedEmail operations. */ public final String templateName() { return templateName; } /** *

* The subject line of the email. *

* * @return The subject line of the email. */ public final String subjectPart() { return subjectPart; } /** *

* The email body that will be visible to recipients whose email clients do not display HTML. *

* * @return The email body that will be visible to recipients whose email clients do not display HTML. */ public final String textPart() { return textPart; } /** *

* The HTML body of the email. *

* * @return The HTML body of the email. */ public final String htmlPart() { return htmlPart; } @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(templateName()); hashCode = 31 * hashCode + Objects.hashCode(subjectPart()); hashCode = 31 * hashCode + Objects.hashCode(textPart()); hashCode = 31 * hashCode + Objects.hashCode(htmlPart()); 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 Template)) { return false; } Template other = (Template) obj; return Objects.equals(templateName(), other.templateName()) && Objects.equals(subjectPart(), other.subjectPart()) && Objects.equals(textPart(), other.textPart()) && Objects.equals(htmlPart(), other.htmlPart()); } /** * 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("Template").add("TemplateName", templateName()).add("SubjectPart", subjectPart()) .add("TextPart", textPart()).add("HtmlPart", htmlPart()).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "TemplateName": return Optional.ofNullable(clazz.cast(templateName())); case "SubjectPart": return Optional.ofNullable(clazz.cast(subjectPart())); case "TextPart": return Optional.ofNullable(clazz.cast(textPart())); case "HtmlPart": return Optional.ofNullable(clazz.cast(htmlPart())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((Template) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* The name of the template. You will refer to this name when you send email using the * SendTemplatedEmail or SendBulkTemplatedEmail operations. *

* * @param templateName * The name of the template. You will refer to this name when you send email using the * SendTemplatedEmail or SendBulkTemplatedEmail operations. * @return Returns a reference to this object so that method calls can be chained together. */ Builder templateName(String templateName); /** *

* The subject line of the email. *

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

* The email body that will be visible to recipients whose email clients do not display HTML. *

* * @param textPart * The email body that will be visible to recipients whose email clients do not display HTML. * @return Returns a reference to this object so that method calls can be chained together. */ Builder textPart(String textPart); /** *

* The HTML body of the email. *

* * @param htmlPart * The HTML body of the email. * @return Returns a reference to this object so that method calls can be chained together. */ Builder htmlPart(String htmlPart); } static final class BuilderImpl implements Builder { private String templateName; private String subjectPart; private String textPart; private String htmlPart; private BuilderImpl() { } private BuilderImpl(Template model) { templateName(model.templateName); subjectPart(model.subjectPart); textPart(model.textPart); htmlPart(model.htmlPart); } public final String getTemplateName() { return templateName; } @Override public final Builder templateName(String templateName) { this.templateName = templateName; return this; } public final void setTemplateName(String templateName) { this.templateName = templateName; } public final String getSubjectPart() { return subjectPart; } @Override public final Builder subjectPart(String subjectPart) { this.subjectPart = subjectPart; return this; } public final void setSubjectPart(String subjectPart) { this.subjectPart = subjectPart; } public final String getTextPart() { return textPart; } @Override public final Builder textPart(String textPart) { this.textPart = textPart; return this; } public final void setTextPart(String textPart) { this.textPart = textPart; } public final String getHtmlPart() { return htmlPart; } @Override public final Builder htmlPart(String htmlPart) { this.htmlPart = htmlPart; return this; } public final void setHtmlPart(String htmlPart) { this.htmlPart = htmlPart; } @Override public Template build() { return new Template(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy