com.amazonaws.services.pinpoint.model.SMSMessage Maven / Gradle / Ivy
/*
* Copyright 2010-2018 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;
/**
* SMS Message.
*/
public class SMSMessage implements Serializable {
/**
* The message body of the notification, the email body or the text message.
*/
private String body;
/**
* Is this a transaction priority message or lower priority.
*
* Constraints:
* Allowed Values: TRANSACTIONAL, PROMOTIONAL
*/
private String messageType;
/**
* The phone number that the SMS message originates from. Specify one of the
* dedicated long codes or short codes that you requested from AWS Support
* and that is assigned to your account. If this attribute is not specified,
* Amazon Pinpoint randomly assigns a long code.
*/
private String originationNumber;
/**
* The sender ID that is shown as the message sender on the recipient's
* device. Support for sender IDs varies by country or region.
*/
private String senderId;
/**
* Default message substitutions. Can be overridden by individual address
* substitutions.
*/
private java.util.Map> substitutions;
/**
* The message body of the notification, the email body or the text message.
*
* @return The message body of the notification, the email body or the text
* message.
*/
public String getBody() {
return body;
}
/**
* The message body of the notification, the email body or the text message.
*
* @param body The message body of the notification, the email body or the
* text message.
*/
public void setBody(String body) {
this.body = body;
}
/**
* The message body of the notification, the email body or the text message.
*
* Returns a reference to this object so that method calls can be chained
* together.
*
* @param body The message body of the notification, the email body or the
* text message.
* @return A reference to this updated object so that method calls can be
* chained together.
*/
public SMSMessage withBody(String body) {
this.body = body;
return this;
}
/**
* Is this a transaction priority message or lower priority.
*
* Constraints:
* Allowed Values: TRANSACTIONAL, PROMOTIONAL
*
* @return Is this a transaction priority message or lower priority.
* @see MessageType
*/
public String getMessageType() {
return messageType;
}
/**
* Is this a transaction priority message or lower priority.
*
* Constraints:
* Allowed Values: TRANSACTIONAL, PROMOTIONAL
*
* @param messageType Is this a transaction priority message or lower
* priority.
* @see MessageType
*/
public void setMessageType(String messageType) {
this.messageType = messageType;
}
/**
* Is this a transaction priority message or lower priority.
*
* Returns a reference to this object so that method calls can be chained
* together.
*
* Constraints:
* Allowed Values: TRANSACTIONAL, PROMOTIONAL
*
* @param messageType Is this a transaction priority message or lower
* priority.
* @return A reference to this updated object so that method calls can be
* chained together.
* @see MessageType
*/
public SMSMessage withMessageType(String messageType) {
this.messageType = messageType;
return this;
}
/**
* Is this a transaction priority message or lower priority.
*
* Constraints:
* Allowed Values: TRANSACTIONAL, PROMOTIONAL
*
* @param messageType Is this a transaction priority message or lower
* priority.
* @see MessageType
*/
public void setMessageType(MessageType messageType) {
this.messageType = messageType.toString();
}
/**
* Is this a transaction priority message or lower priority.
*
* Returns a reference to this object so that method calls can be chained
* together.
*
* Constraints:
* Allowed Values: TRANSACTIONAL, PROMOTIONAL
*
* @param messageType Is this a transaction priority message or lower
* priority.
* @return A reference to this updated object so that method calls can be
* chained together.
* @see MessageType
*/
public SMSMessage withMessageType(MessageType messageType) {
this.messageType = messageType.toString();
return this;
}
/**
* The phone number that the SMS message originates from. Specify one of the
* dedicated long codes or short codes that you requested from AWS Support
* and that is assigned to your account. If this attribute is not specified,
* Amazon Pinpoint randomly assigns a long code.
*
* @return The phone number that the SMS message originates from. Specify
* one of the dedicated long codes or short codes that you requested
* from AWS Support and that is assigned to your account. If this
* attribute is not specified, Amazon Pinpoint randomly assigns a
* long code.
*/
public String getOriginationNumber() {
return originationNumber;
}
/**
* The phone number that the SMS message originates from. Specify one of the
* dedicated long codes or short codes that you requested from AWS Support
* and that is assigned to your account. If this attribute is not specified,
* Amazon Pinpoint randomly assigns a long code.
*
* @param originationNumber The phone number that the SMS message originates
* from. Specify one of the dedicated long codes or short codes
* that you requested from AWS Support and that is assigned to
* your account. If this attribute is not specified, Amazon
* Pinpoint randomly assigns a long code.
*/
public void setOriginationNumber(String originationNumber) {
this.originationNumber = originationNumber;
}
/**
* The phone number that the SMS message originates from. Specify one of the
* dedicated long codes or short codes that you requested from AWS Support
* and that is assigned to your account. If this attribute is not specified,
* Amazon Pinpoint randomly assigns a long code.
*
* Returns a reference to this object so that method calls can be chained
* together.
*
* @param originationNumber The phone number that the SMS message originates
* from. Specify one of the dedicated long codes or short codes
* that you requested from AWS Support and that is assigned to
* your account. If this attribute is not specified, Amazon
* Pinpoint randomly assigns a long code.
* @return A reference to this updated object so that method calls can be
* chained together.
*/
public SMSMessage withOriginationNumber(String originationNumber) {
this.originationNumber = originationNumber;
return this;
}
/**
* The sender ID that is shown as the message sender on the recipient's
* device. Support for sender IDs varies by country or region.
*
* @return The sender ID that is shown as the message sender on the
* recipient's device. Support for sender IDs varies by country or
* region.
*/
public String getSenderId() {
return senderId;
}
/**
* The sender ID that is shown as the message sender on the recipient's
* device. Support for sender IDs varies by country or region.
*
* @param senderId The sender ID that is shown as the message sender on the
* recipient's device. Support for sender IDs varies by country
* or region.
*/
public void setSenderId(String senderId) {
this.senderId = senderId;
}
/**
* The sender ID that is shown as the message sender on the recipient's
* device. Support for sender IDs varies by country or region.
*
* Returns a reference to this object so that method calls can be chained
* together.
*
* @param senderId The sender ID that is shown as the message sender on the
* recipient's device. Support for sender IDs varies by country
* or region.
* @return A reference to this updated object so that method calls can be
* chained together.
*/
public SMSMessage withSenderId(String senderId) {
this.senderId = senderId;
return this;
}
/**
* Default message substitutions. Can be overridden by individual address
* substitutions.
*
* @return Default message substitutions. Can be overridden by individual
* address substitutions.
*/
public java.util.Map> getSubstitutions() {
return substitutions;
}
/**
* Default message substitutions. Can be overridden by individual address
* substitutions.
*
* @param substitutions Default message substitutions. Can be overridden by
* individual address substitutions.
*/
public void setSubstitutions(java.util.Map> substitutions) {
this.substitutions = substitutions;
}
/**
* Default message substitutions. Can be overridden by individual address
* substitutions.
*
* Returns a reference to this object so that method calls can be chained
* together.
*
* @param substitutions Default message substitutions. Can be overridden by
* individual address substitutions.
* @return A reference to this updated object so that method calls can be
* chained together.
*/
public SMSMessage withSubstitutions(java.util.Map> substitutions) {
this.substitutions = substitutions;
return this;
}
/**
* Default message substitutions. Can be overridden by individual address
* substitutions.
*
* The method adds a new key-value pair into Substitutions parameter, and
* returns a reference to this object so that method calls can be chained
* together.
*
* @param key The key of the entry to be added into Substitutions.
* @param value The corresponding value of the entry to be added into
* Substitutions.
* @return A reference to this updated object so that method calls can be
* chained together.
*/
public SMSMessage 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.
*
* Returns a reference to this object so that method calls can be chained
* together.
*/
public SMSMessage clearSubstitutionsEntries() {
this.substitutions = null;
return this;
}
/**
* Returns a string representation of this object; useful for testing and
* debugging.
*
* @return A string representation of this object.
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
if (getBody() != null)
sb.append("Body: " + getBody() + ",");
if (getMessageType() != null)
sb.append("MessageType: " + getMessageType() + ",");
if (getOriginationNumber() != null)
sb.append("OriginationNumber: " + getOriginationNumber() + ",");
if (getSenderId() != null)
sb.append("SenderId: " + getSenderId() + ",");
if (getSubstitutions() != null)
sb.append("Substitutions: " + getSubstitutions());
sb.append("}");
return sb.toString();
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getBody() == null) ? 0 : getBody().hashCode());
hashCode = prime * hashCode
+ ((getMessageType() == null) ? 0 : getMessageType().hashCode());
hashCode = prime * hashCode
+ ((getOriginationNumber() == null) ? 0 : getOriginationNumber().hashCode());
hashCode = prime * hashCode + ((getSenderId() == null) ? 0 : getSenderId().hashCode());
hashCode = prime * hashCode
+ ((getSubstitutions() == null) ? 0 : getSubstitutions().hashCode());
return hashCode;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof SMSMessage == false)
return false;
SMSMessage other = (SMSMessage) obj;
if (other.getBody() == null ^ this.getBody() == null)
return false;
if (other.getBody() != null && other.getBody().equals(this.getBody()) == false)
return false;
if (other.getMessageType() == null ^ this.getMessageType() == null)
return false;
if (other.getMessageType() != null
&& other.getMessageType().equals(this.getMessageType()) == false)
return false;
if (other.getOriginationNumber() == null ^ this.getOriginationNumber() == null)
return false;
if (other.getOriginationNumber() != null
&& other.getOriginationNumber().equals(this.getOriginationNumber()) == false)
return false;
if (other.getSenderId() == null ^ this.getSenderId() == null)
return false;
if (other.getSenderId() != null && other.getSenderId().equals(this.getSenderId()) == false)
return false;
if (other.getSubstitutions() == null ^ this.getSubstitutions() == null)
return false;
if (other.getSubstitutions() != null
&& other.getSubstitutions().equals(this.getSubstitutions()) == false)
return false;
return true;
}
}