/* * 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 address-based configuration settings for a message that's sent directly to an endpoint. *

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

* The message body to use instead of the default message body. This value overrides the default message body. *

*/ private String bodyOverride; /** *

* The channel to use when sending the message. *

*/ private String channelType; /** *

* An object that maps custom attributes to attributes for the address and is attached to the message. 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 by properties of the DefaultMessage object. * The variables specified in this map take precedence over all other variables. *

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

* The message title to use instead of the default message title. This value overrides the default message title. *

*/ private String titleOverride; /** *

* The message body to use instead of the default message body. This value overrides the default message body. *

* * @param bodyOverride * The message body to use instead of the default message body. This value overrides the default message * body. */ public void setBodyOverride(String bodyOverride) { this.bodyOverride = bodyOverride; } /** *

* The message body to use instead of the default message body. This value overrides the default message body. *

* * @return The message body to use instead of the default message body. This value overrides the default message * body. */ public String getBodyOverride() { return this.bodyOverride; } /** *

* The message body to use instead of the default message body. This value overrides the default message body. *

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

* The channel to use when sending the message. *

* * @param channelType * The channel to use when sending the message. * @see ChannelType */ public void setChannelType(String channelType) { this.channelType = channelType; } /** *

* The channel to use when sending the message. *

* * @return The channel to use when sending the message. * @see ChannelType */ public String getChannelType() { return this.channelType; } /** *

* The channel to use when sending the message. *

* * @param channelType * The channel to use when sending the message. * @return Returns a reference to this object so that method calls can be chained together. * @see ChannelType */ public AddressConfiguration withChannelType(String channelType) { setChannelType(channelType); return this; } /** *

* The channel to use when sending the message. *

* * @param channelType * The channel to use when sending the message. * @see ChannelType */ public void setChannelType(ChannelType channelType) { withChannelType(channelType); } /** *

* The channel to use when sending the message. *

* * @param channelType * The channel to use when sending the message. * @return Returns a reference to this object so that method calls can be chained together. * @see ChannelType */ public AddressConfiguration withChannelType(ChannelType channelType) { this.channelType = channelType.toString(); return this; } /** *

* An object that maps custom attributes to attributes for the address and is attached to the message. 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 An object that maps custom attributes to attributes for the address and is attached to the message. * 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; } /** *

* An object that maps custom attributes to attributes for the address and is attached to the message. 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 * An object that maps custom attributes to attributes for the address and is attached to the message. * 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; } /** *

* An object that maps custom attributes to attributes for the address and is attached to the message. 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 * An object that maps custom attributes to attributes for the address and is attached to the message. * 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 AddressConfiguration withContext(java.util.Map context) { setContext(context); return this; } /** * Add a single Context entry * * @see AddressConfiguration#withContext * @returns a reference to this object so that method calls can be chained together. */ public AddressConfiguration 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 AddressConfiguration 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 AddressConfiguration withRawContent(String rawContent) { setRawContent(rawContent); return this; } /** *

* A map of the message variables to merge with the variables specified by properties of the DefaultMessage object. * 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 by properties of the DefaultMessage * object. 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 by properties of the DefaultMessage object. * 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 by properties of the DefaultMessage * object. 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 by properties of the DefaultMessage object. * 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 by properties of the DefaultMessage * object. 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 AddressConfiguration withSubstitutions(java.util.Map> substitutions) { setSubstitutions(substitutions); return this; } /** * Add a single Substitutions entry * * @see AddressConfiguration#withSubstitutions * @returns a reference to this object so that method calls can be chained together. */ public AddressConfiguration 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 AddressConfiguration clearSubstitutionsEntries() { this.substitutions = null; return this; } /** *

* The message title to use instead of the default message title. This value overrides the default message title. *

* * @param titleOverride * The message title to use instead of the default message title. This value overrides the default message * title. */ public void setTitleOverride(String titleOverride) { this.titleOverride = titleOverride; } /** *

* The message title to use instead of the default message title. This value overrides the default message title. *

* * @return The message title to use instead of the default message title. This value overrides the default message * title. */ public String getTitleOverride() { return this.titleOverride; } /** *

* The message title to use instead of the default message title. This value overrides the default message title. *

* * @param titleOverride * The message title to use instead of the default message title. This value overrides the default message * title. * @return Returns a reference to this object so that method calls can be chained together. */ public AddressConfiguration 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 (getChannelType() != null) sb.append("ChannelType: ").append(getChannelType()).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 AddressConfiguration == false) return false; AddressConfiguration other = (AddressConfiguration) obj; if (other.getBodyOverride() == null ^ this.getBodyOverride() == null) return false; if (other.getBodyOverride() != null && other.getBodyOverride().equals(this.getBodyOverride()) == false) return false; if (other.getChannelType() == null ^ this.getChannelType() == null) return false; if (other.getChannelType() != null && other.getChannelType().equals(this.getChannelType()) == 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 + ((getChannelType() == null) ? 0 : getChannelType().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 AddressConfiguration clone() { try { return (AddressConfiguration) 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.AddressConfigurationMarshaller.getInstance().marshall(this, protocolMarshaller); } }