software.amazon.awssdk.services.pinpoint.model.CampaignEmailMessage Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pinpoint Show documentation
Show all versions of pinpoint Show documentation
The AWS Java SDK for Amazon Pinpoint module holds the client classes that are used for communicating
with Amazon Pinpoint Service
/*
* 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 extends Builder> 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
© 2015 - 2025 Weber Informatics LLC | Privacy Policy