/* * Copyright 2010-2020 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.simpleemail.model; import java.io.Serializable; /** *

* The content of the email, composed of a subject line, an HTML part, and a * text-only part. *

*/ public class Template implements Serializable { /** *

* The name of the template. You will refer to this name when you send email * using the SendTemplatedEmail or * SendBulkTemplatedEmail operations. *

*/ private String templateName; /** *

* The subject line of the email. *

*/ private String subjectPart; /** *

* The email body that will be visible to recipients whose email clients do * not display HTML. *

*/ private String textPart; /** *

* The HTML body of the email. *

*/ private String htmlPart; /** *

* The name of the template. You will refer to this name when you send email * using the SendTemplatedEmail or * SendBulkTemplatedEmail operations. *

* * @return

* The name of the template. You will refer to this name when you * send email using the SendTemplatedEmail or * SendBulkTemplatedEmail operations. *

*/ public String getTemplateName() { return templateName; } /** *

* The name of the template. You will refer to this name when you send email * using the SendTemplatedEmail or * SendBulkTemplatedEmail operations. *

* * @param templateName

* The name of the template. You will refer to this name when you * send email using the SendTemplatedEmail or * SendBulkTemplatedEmail operations. *

*/ public void setTemplateName(String templateName) { this.templateName = templateName; } /** *

* The name of the template. You will refer to this name when you send email * using the SendTemplatedEmail or * SendBulkTemplatedEmail operations. *

*

* Returns a reference to this object so that method calls can be chained * together. * * @param templateName

* The name of the template. You will refer to this name when you * send email using the SendTemplatedEmail or * SendBulkTemplatedEmail operations. *

* @return A reference to this updated object so that method calls can be * chained together. */ public Template withTemplateName(String templateName) { this.templateName = templateName; return this; } /** *

* The subject line of the email. *

* * @return

* The subject line of the email. *

*/ public String getSubjectPart() { return subjectPart; } /** *

* The subject line of the email. *

* * @param subjectPart

* The subject line of the email. *

*/ public void setSubjectPart(String subjectPart) { this.subjectPart = subjectPart; } /** *

* The subject line of the email. *

*

* Returns a reference to this object so that method calls can be chained * together. * * @param subjectPart

* The subject line of the email. *

* @return A reference to this updated object so that method calls can be * chained together. */ public Template withSubjectPart(String subjectPart) { this.subjectPart = subjectPart; return this; } /** *

* The email body that will be visible to recipients whose email clients do * not display HTML. *

* * @return

* The email body that will be visible to recipients whose email * clients do not display HTML. *

*/ public String getTextPart() { return textPart; } /** *

* The email body that will be visible to recipients whose email clients do * not display HTML. *

* * @param textPart

* The email body that will be visible to recipients whose email * clients do not display HTML. *

*/ public void setTextPart(String textPart) { this.textPart = textPart; } /** *

* The email body that will be visible to recipients whose email clients do * not display HTML. *

*

* Returns a reference to this object so that method calls can be chained * together. * * @param textPart

* The email body that will be visible to recipients whose email * clients do not display HTML. *

* @return A reference to this updated object so that method calls can be * chained together. */ public Template withTextPart(String textPart) { this.textPart = textPart; return this; } /** *

* The HTML body of the email. *

* * @return

* The HTML body of the email. *

*/ public String getHtmlPart() { return htmlPart; } /** *

* The HTML body of the email. *

* * @param htmlPart

* The HTML body of the email. *

*/ public void setHtmlPart(String htmlPart) { this.htmlPart = htmlPart; } /** *

* The HTML body of the email. *

*

* Returns a reference to this object so that method calls can be chained * together. * * @param htmlPart

* The HTML body of the email. *

* @return A reference to this updated object so that method calls can be * chained together. */ public Template withHtmlPart(String htmlPart) { this.htmlPart = htmlPart; 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 (getTemplateName() != null) sb.append("TemplateName: " + getTemplateName() + ","); if (getSubjectPart() != null) sb.append("SubjectPart: " + getSubjectPart() + ","); if (getTextPart() != null) sb.append("TextPart: " + getTextPart() + ","); if (getHtmlPart() != null) sb.append("HtmlPart: " + getHtmlPart()); sb.append("}"); return sb.toString(); } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getTemplateName() == null) ? 0 : getTemplateName().hashCode()); hashCode = prime * hashCode + ((getSubjectPart() == null) ? 0 : getSubjectPart().hashCode()); hashCode = prime * hashCode + ((getTextPart() == null) ? 0 : getTextPart().hashCode()); hashCode = prime * hashCode + ((getHtmlPart() == null) ? 0 : getHtmlPart().hashCode()); return hashCode; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof Template == false) return false; Template other = (Template) obj; if (other.getTemplateName() == null ^ this.getTemplateName() == null) return false; if (other.getTemplateName() != null && other.getTemplateName().equals(this.getTemplateName()) == false) return false; if (other.getSubjectPart() == null ^ this.getSubjectPart() == null) return false; if (other.getSubjectPart() != null && other.getSubjectPart().equals(this.getSubjectPart()) == false) return false; if (other.getTextPart() == null ^ this.getTextPart() == null) return false; if (other.getTextPart() != null && other.getTextPart().equals(this.getTextPart()) == false) return false; if (other.getHtmlPart() == null ^ this.getHtmlPart() == null) return false; if (other.getHtmlPart() != null && other.getHtmlPart().equals(this.getHtmlPart()) == false) return false; return true; } }