/* * Copyright 2018-2023 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 com.amazonaws.services.pinpoint.model; import java.io.Serializable; import javax.annotation.Generated; import com.amazonaws.protocol.StructuredPojo; import com.amazonaws.protocol.ProtocolMarshaller; /** *

* Specifies the content, including message variables and attributes, to use in a message that's sent directly to an * endpoint. *

* * @see AWS * API Documentation */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class EndpointSendConfiguration implements Serializable, Cloneable, StructuredPojo { /** *

* The body of the message. If specified, this value overrides the default message body. *

*/ private String bodyOverride; /** *

* A map of custom attributes to attach to the message for the address. Attribute names are case sensitive. *

*

* For a push notification, this payload is added to the data.pinpoint object. For an email or text message, this * payload is added to email/SMS delivery receipt event attributes. *

*/ private java.util.Map context; /** *

* The raw, JSON-formatted string to use as the payload for the message. If specified, this value overrides all * other values for the message. *

*/ private String rawContent; /** *

* A map of the message variables to merge with the variables specified for the default message * (DefaultMessage.Substitutions). The variables specified in this map take precedence over all other variables. *

*/ private java.util.Map> substitutions; /** *

* The title or subject line of the message. If specified, this value overrides the default message title or subject * line. *

*/ private String titleOverride; /** *

* The body of the message. If specified, this value overrides the default message body. *

* * @param bodyOverride * The body of the message. If specified, this value overrides the default message body. */ public void setBodyOverride(String bodyOverride) { this.bodyOverride = bodyOverride; } /** *

* The body of the message. If specified, this value overrides the default message body. *

* * @return The body of the message. If specified, this value overrides the default message body. */ public String getBodyOverride() { return this.bodyOverride; } /** *

* The body of the message. If specified, this value overrides the default message body. *

* * @param bodyOverride * The body of the message. If specified, this value overrides the default message body. * @return Returns a reference to this object so that method calls can be chained together. */ public EndpointSendConfiguration withBodyOverride(String bodyOverride) { setBodyOverride(bodyOverride); return this; } /** *

* A map of custom attributes to attach to the message for the address. Attribute names are case sensitive. *

*

* For a push notification, this payload is added to the data.pinpoint object. For an email or text message, this * payload is added to email/SMS delivery receipt event attributes. *

* * @return A map of custom attributes to attach to the message for the address. Attribute names are case * sensitive.

*

* For a push notification, this payload is added to the data.pinpoint object. For an email or text message, * this payload is added to email/SMS delivery receipt event attributes. */ public java.util.Map getContext() { return context; } /** *

* A map of custom attributes to attach to the message for the address. Attribute names are case sensitive. *

*

* For a push notification, this payload is added to the data.pinpoint object. For an email or text message, this * payload is added to email/SMS delivery receipt event attributes. *

* * @param context * A map of custom attributes to attach to the message for the address. Attribute names are case * sensitive.

*

* For a push notification, this payload is added to the data.pinpoint object. For an email or text message, * this payload is added to email/SMS delivery receipt event attributes. */ public void setContext(java.util.Map context) { this.context = context; } /** *

* A map of custom attributes to attach to the message for the address. Attribute names are case sensitive. *

*

* For a push notification, this payload is added to the data.pinpoint object. For an email or text message, this * payload is added to email/SMS delivery receipt event attributes. *

* * @param context * A map of custom attributes to attach to the message for the address. Attribute names are case * sensitive.

*

* For a push notification, this payload is added to the data.pinpoint object. For an email or text message, * this payload is added to email/SMS delivery receipt event attributes. * @return Returns a reference to this object so that method calls can be chained together. */ public EndpointSendConfiguration withContext(java.util.Map context) { setContext(context); return this; } /** * Add a single Context entry * * @see EndpointSendConfiguration#withContext * @returns a reference to this object so that method calls can be chained together. */ public EndpointSendConfiguration addContextEntry(String key, String value) { if (null == this.context) { this.context = new java.util.HashMap(); } if (this.context.containsKey(key)) throw new IllegalArgumentException("Duplicated keys (" + key.toString() + ") are provided."); this.context.put(key, value); return this; } /** * Removes all the entries added into Context. * * @return Returns a reference to this object so that method calls can be chained together. */ public EndpointSendConfiguration clearContextEntries() { this.context = null; return this; } /** *

* The raw, JSON-formatted string to use as the payload for the message. If specified, this value overrides all * other values for the message. *

* * @param rawContent * The raw, JSON-formatted string to use as the payload for the message. If specified, this value overrides * all other values for the message. */ public void setRawContent(String rawContent) { this.rawContent = rawContent; } /** *

* The raw, JSON-formatted string to use as the payload for the message. If specified, this value overrides all * other values for the message. *

* * @return The raw, JSON-formatted string to use as the payload for the message. If specified, this value overrides * all other values for the message. */ public String getRawContent() { return this.rawContent; } /** *

* The raw, JSON-formatted string to use as the payload for the message. If specified, this value overrides all * other values for the message. *

* * @param rawContent * The raw, JSON-formatted string to use as the payload for the message. If specified, this value overrides * all other values for the message. * @return Returns a reference to this object so that method calls can be chained together. */ public EndpointSendConfiguration withRawContent(String rawContent) { setRawContent(rawContent); return this; } /** *

* A map of the message variables to merge with the variables specified for the default message * (DefaultMessage.Substitutions). The variables specified in this map take precedence over all other variables. *

* * @return A map of the message variables to merge with the variables specified for the default message * (DefaultMessage.Substitutions). The variables specified in this map take precedence over all other * variables. */ public java.util.Map> getSubstitutions() { return substitutions; } /** *

* A map of the message variables to merge with the variables specified for the default message * (DefaultMessage.Substitutions). The variables specified in this map take precedence over all other variables. *

* * @param substitutions * A map of the message variables to merge with the variables specified for the default message * (DefaultMessage.Substitutions). The variables specified in this map take precedence over all other * variables. */ public void setSubstitutions(java.util.Map> substitutions) { this.substitutions = substitutions; } /** *

* A map of the message variables to merge with the variables specified for the default message * (DefaultMessage.Substitutions). The variables specified in this map take precedence over all other variables. *

* * @param substitutions * A map of the message variables to merge with the variables specified for the default message * (DefaultMessage.Substitutions). The variables specified in this map take precedence over all other * variables. * @return Returns a reference to this object so that method calls can be chained together. */ public EndpointSendConfiguration withSubstitutions(java.util.Map> substitutions) { setSubstitutions(substitutions); return this; } /** * Add a single Substitutions entry * * @see EndpointSendConfiguration#withSubstitutions * @returns a reference to this object so that method calls can be chained together. */ public EndpointSendConfiguration addSubstitutionsEntry(String key, java.util.List value) { if (null == this.substitutions) { this.substitutions = new java.util.HashMap>(); } if (this.substitutions.containsKey(key)) throw new IllegalArgumentException("Duplicated keys (" + key.toString() + ") are provided."); this.substitutions.put(key, value); return this; } /** * Removes all the entries added into Substitutions. * * @return Returns a reference to this object so that method calls can be chained together. */ public EndpointSendConfiguration clearSubstitutionsEntries() { this.substitutions = null; return this; } /** *

* The title or subject line of the message. If specified, this value overrides the default message title or subject * line. *

* * @param titleOverride * The title or subject line of the message. If specified, this value overrides the default message title or * subject line. */ public void setTitleOverride(String titleOverride) { this.titleOverride = titleOverride; } /** *

* The title or subject line of the message. If specified, this value overrides the default message title or subject * line. *

* * @return The title or subject line of the message. If specified, this value overrides the default message title or * subject line. */ public String getTitleOverride() { return this.titleOverride; } /** *

* The title or subject line of the message. If specified, this value overrides the default message title or subject * line. *

* * @param titleOverride * The title or subject line of the message. If specified, this value overrides the default message title or * subject line. * @return Returns a reference to this object so that method calls can be chained together. */ public EndpointSendConfiguration withTitleOverride(String titleOverride) { setTitleOverride(titleOverride); return this; } /** * 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. * * @return A string representation of this object. * * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getBodyOverride() != null) sb.append("BodyOverride: ").append(getBodyOverride()).append(","); if (getContext() != null) sb.append("Context: ").append(getContext()).append(","); if (getRawContent() != null) sb.append("RawContent: ").append(getRawContent()).append(","); if (getSubstitutions() != null) sb.append("Substitutions: ").append(getSubstitutions()).append(","); if (getTitleOverride() != null) sb.append("TitleOverride: ").append(getTitleOverride()); sb.append("}"); return sb.toString(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof EndpointSendConfiguration == false) return false; EndpointSendConfiguration other = (EndpointSendConfiguration) obj; if (other.getBodyOverride() == null ^ this.getBodyOverride() == null) return false; if (other.getBodyOverride() != null && other.getBodyOverride().equals(this.getBodyOverride()) == false) return false; if (other.getContext() == null ^ this.getContext() == null) return false; if (other.getContext() != null && other.getContext().equals(this.getContext()) == false) return false; if (other.getRawContent() == null ^ this.getRawContent() == null) return false; if (other.getRawContent() != null && other.getRawContent().equals(this.getRawContent()) == false) return false; if (other.getSubstitutions() == null ^ this.getSubstitutions() == null) return false; if (other.getSubstitutions() != null && other.getSubstitutions().equals(this.getSubstitutions()) == false) return false; if (other.getTitleOverride() == null ^ this.getTitleOverride() == null) return false; if (other.getTitleOverride() != null && other.getTitleOverride().equals(this.getTitleOverride()) == false) return false; return true; } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getBodyOverride() == null) ? 0 : getBodyOverride().hashCode()); hashCode = prime * hashCode + ((getContext() == null) ? 0 : getContext().hashCode()); hashCode = prime * hashCode + ((getRawContent() == null) ? 0 : getRawContent().hashCode()); hashCode = prime * hashCode + ((getSubstitutions() == null) ? 0 : getSubstitutions().hashCode()); hashCode = prime * hashCode + ((getTitleOverride() == null) ? 0 : getTitleOverride().hashCode()); return hashCode; } @Override public EndpointSendConfiguration clone() { try { return (EndpointSendConfiguration) super.clone(); } catch (CloneNotSupportedException e) { throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e); } } @com.amazonaws.annotation.SdkInternalApi @Override public void marshall(ProtocolMarshaller protocolMarshaller) { com.amazonaws.services.pinpoint.model.transform.EndpointSendConfigurationMarshaller.getInstance().marshall(this, protocolMarshaller); } }