All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.amazonaws.services.pinpoint.model.DefaultMessage 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;

/**
 * Default Message across push notification, email, and sms.
 */
public class DefaultMessage implements Serializable {
    /**
     * The message body of the notification, the email body or the text message.
     */
    private String body;

    /**
     * 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 DefaultMessage withBody(String body) { this.body = body; 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 DefaultMessage 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 DefaultMessage 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 DefaultMessage 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 (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 + ((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 DefaultMessage == false) return false; DefaultMessage other = (DefaultMessage) obj; if (other.getBody() == null ^ this.getBody() == null) return false; if (other.getBody() != null && other.getBody().equals(this.getBody()) == 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; } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy