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

software.amazon.awssdk.services.pinpoint.model.CampaignEmailMessage Maven / Gradle / Ivy

Go to download

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

There is a newer version: 2.29.39
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.pinpoint.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;

/**
 * 

* Specifies the content and "From" address for an email message that's sent to recipients of a campaign. *

*/ @Generated("software.amazon.awssdk:codegen") public final class CampaignEmailMessage implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField BODY_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Body") .getter(getter(CampaignEmailMessage::body)).setter(setter(Builder::body)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Body").build()).build(); private static final SdkField FROM_ADDRESS_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("FromAddress").getter(getter(CampaignEmailMessage::fromAddress)).setter(setter(Builder::fromAddress)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("FromAddress").build()).build(); private static final SdkField HTML_BODY_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("HtmlBody").getter(getter(CampaignEmailMessage::htmlBody)).setter(setter(Builder::htmlBody)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("HtmlBody").build()).build(); private static final SdkField TITLE_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Title") .getter(getter(CampaignEmailMessage::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(BODY_FIELD, FROM_ADDRESS_FIELD, HTML_BODY_FIELD, TITLE_FIELD)); private static final long serialVersionUID = 1L; private final String body; private final String fromAddress; private final String htmlBody; private final String title; private CampaignEmailMessage(BuilderImpl builder) { this.body = builder.body; this.fromAddress = builder.fromAddress; this.htmlBody = builder.htmlBody; this.title = builder.title; } /** *

* The body of the email for recipients whose email clients don't render HTML content. *

* * @return The body of the email for recipients whose email clients don't render HTML content. */ public final String body() { return body; } /** *

* The verified email address to send the email from. The default address is the FromAddress specified for the email * channel for the application. *

* * @return The verified email address to send the email from. The default address is the FromAddress specified for * the email channel for the application. */ public final String fromAddress() { return fromAddress; } /** *

* The body of the email, in HTML format, for recipients whose email clients render HTML content. *

* * @return The body of the email, in HTML format, for recipients whose email clients render HTML content. */ public final String htmlBody() { return htmlBody; } /** *

* The subject line, or title, of the email. *

* * @return The subject line, or title, of the email. */ 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(body()); hashCode = 31 * hashCode + Objects.hashCode(fromAddress()); hashCode = 31 * hashCode + Objects.hashCode(htmlBody()); 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 CampaignEmailMessage)) { return false; } CampaignEmailMessage other = (CampaignEmailMessage) obj; return Objects.equals(body(), other.body()) && Objects.equals(fromAddress(), other.fromAddress()) && Objects.equals(htmlBody(), other.htmlBody()) && 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("CampaignEmailMessage").add("Body", body()).add("FromAddress", fromAddress()) .add("HtmlBody", htmlBody()).add("Title", title()).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "Body": return Optional.ofNullable(clazz.cast(body())); case "FromAddress": return Optional.ofNullable(clazz.cast(fromAddress())); case "HtmlBody": return Optional.ofNullable(clazz.cast(htmlBody())); case "Title": return Optional.ofNullable(clazz.cast(title())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((CampaignEmailMessage) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* The body of the email for recipients whose email clients don't render HTML content. *

* * @param body * The body of the email for recipients whose email clients don't render HTML content. * @return Returns a reference to this object so that method calls can be chained together. */ Builder body(String body); /** *

* The verified email address to send the email from. The default address is the FromAddress specified for the * email channel for the application. *

* * @param fromAddress * The verified email address to send the email from. The default address is the FromAddress specified * for the email channel for the application. * @return Returns a reference to this object so that method calls can be chained together. */ Builder fromAddress(String fromAddress); /** *

* The body of the email, in HTML format, for recipients whose email clients render HTML content. *

* * @param htmlBody * The body of the email, in HTML format, for recipients whose email clients render HTML content. * @return Returns a reference to this object so that method calls can be chained together. */ Builder htmlBody(String htmlBody); /** *

* The subject line, or title, of the email. *

* * @param title * The subject line, or title, of the email. * @return Returns a reference to this object so that method calls can be chained together. */ Builder title(String title); } static final class BuilderImpl implements Builder { private String body; private String fromAddress; private String htmlBody; private String title; private BuilderImpl() { } private BuilderImpl(CampaignEmailMessage model) { body(model.body); fromAddress(model.fromAddress); htmlBody(model.htmlBody); title(model.title); } public final String getBody() { return body; } public final void setBody(String body) { this.body = body; } @Override public final Builder body(String body) { this.body = body; return this; } public final String getFromAddress() { return fromAddress; } public final void setFromAddress(String fromAddress) { this.fromAddress = fromAddress; } @Override public final Builder fromAddress(String fromAddress) { this.fromAddress = fromAddress; return this; } public final String getHtmlBody() { return htmlBody; } public final void setHtmlBody(String htmlBody) { this.htmlBody = htmlBody; } @Override public final Builder htmlBody(String htmlBody) { this.htmlBody = htmlBody; return this; } public final String getTitle() { return title; } public final void setTitle(String title) { this.title = title; } @Override public final Builder title(String title) { this.title = title; return this; } @Override public CampaignEmailMessage build() { return new CampaignEmailMessage(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy