software.amazon.awssdk.services.pinpoint.model.TemplateConfiguration 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.Consumer;
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 message template to use for the message, for each type of channel.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class TemplateConfiguration implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField EMAIL_TEMPLATE_FIELD = SdkField. builder(MarshallingType.SDK_POJO)
.memberName("EmailTemplate").getter(getter(TemplateConfiguration::emailTemplate))
.setter(setter(Builder::emailTemplate)).constructor(Template::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("EmailTemplate").build()).build();
private static final SdkField PUSH_TEMPLATE_FIELD = SdkField. builder(MarshallingType.SDK_POJO)
.memberName("PushTemplate").getter(getter(TemplateConfiguration::pushTemplate)).setter(setter(Builder::pushTemplate))
.constructor(Template::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("PushTemplate").build()).build();
private static final SdkField SMS_TEMPLATE_FIELD = SdkField. builder(MarshallingType.SDK_POJO)
.memberName("SMSTemplate").getter(getter(TemplateConfiguration::smsTemplate)).setter(setter(Builder::smsTemplate))
.constructor(Template::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SMSTemplate").build()).build();
private static final SdkField VOICE_TEMPLATE_FIELD = SdkField. builder(MarshallingType.SDK_POJO)
.memberName("VoiceTemplate").getter(getter(TemplateConfiguration::voiceTemplate))
.setter(setter(Builder::voiceTemplate)).constructor(Template::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("VoiceTemplate").build()).build();
private static final SdkField IN_APP_TEMPLATE_FIELD = SdkField. builder(MarshallingType.SDK_POJO)
.memberName("InAppTemplate").getter(getter(TemplateConfiguration::inAppTemplate))
.setter(setter(Builder::inAppTemplate)).constructor(Template::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("InAppTemplate").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(EMAIL_TEMPLATE_FIELD,
PUSH_TEMPLATE_FIELD, SMS_TEMPLATE_FIELD, VOICE_TEMPLATE_FIELD, IN_APP_TEMPLATE_FIELD));
private static final long serialVersionUID = 1L;
private final Template emailTemplate;
private final Template pushTemplate;
private final Template smsTemplate;
private final Template voiceTemplate;
private final Template inAppTemplate;
private TemplateConfiguration(BuilderImpl builder) {
this.emailTemplate = builder.emailTemplate;
this.pushTemplate = builder.pushTemplate;
this.smsTemplate = builder.smsTemplate;
this.voiceTemplate = builder.voiceTemplate;
this.inAppTemplate = builder.inAppTemplate;
}
/**
*
* The email template to use for the message.
*
*
* @return The email template to use for the message.
*/
public final Template emailTemplate() {
return emailTemplate;
}
/**
*
* The push notification template to use for the message.
*
*
* @return The push notification template to use for the message.
*/
public final Template pushTemplate() {
return pushTemplate;
}
/**
*
* The SMS template to use for the message.
*
*
* @return The SMS template to use for the message.
*/
public final Template smsTemplate() {
return smsTemplate;
}
/**
*
* The voice template to use for the message. This object isn't supported for campaigns.
*
*
* @return The voice template to use for the message. This object isn't supported for campaigns.
*/
public final Template voiceTemplate() {
return voiceTemplate;
}
/**
*
* The InApp template to use for the message. The InApp template object is not supported for SendMessages.
*
*
* @return The InApp template to use for the message. The InApp template object is not supported for SendMessages.
*/
public final Template inAppTemplate() {
return inAppTemplate;
}
@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(emailTemplate());
hashCode = 31 * hashCode + Objects.hashCode(pushTemplate());
hashCode = 31 * hashCode + Objects.hashCode(smsTemplate());
hashCode = 31 * hashCode + Objects.hashCode(voiceTemplate());
hashCode = 31 * hashCode + Objects.hashCode(inAppTemplate());
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 TemplateConfiguration)) {
return false;
}
TemplateConfiguration other = (TemplateConfiguration) obj;
return Objects.equals(emailTemplate(), other.emailTemplate()) && Objects.equals(pushTemplate(), other.pushTemplate())
&& Objects.equals(smsTemplate(), other.smsTemplate()) && Objects.equals(voiceTemplate(), other.voiceTemplate())
&& Objects.equals(inAppTemplate(), other.inAppTemplate());
}
/**
* 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("TemplateConfiguration").add("EmailTemplate", emailTemplate())
.add("PushTemplate", pushTemplate()).add("SMSTemplate", smsTemplate()).add("VoiceTemplate", voiceTemplate())
.add("InAppTemplate", inAppTemplate()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "EmailTemplate":
return Optional.ofNullable(clazz.cast(emailTemplate()));
case "PushTemplate":
return Optional.ofNullable(clazz.cast(pushTemplate()));
case "SMSTemplate":
return Optional.ofNullable(clazz.cast(smsTemplate()));
case "VoiceTemplate":
return Optional.ofNullable(clazz.cast(voiceTemplate()));
case "InAppTemplate":
return Optional.ofNullable(clazz.cast(inAppTemplate()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function