com.amazonaws.services.simpleemail.model.Template Maven / Gradle / Ivy
Show all versions of aws-java-sdk-ses Show documentation
/*
* Copyright 2019-2024 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;
import javax.annotation.Generated;
/**
*
* The content of the email, composed of a subject line and either an HTML part or a text-only part.
*
*
* @see AWS API
* Documentation
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class Template implements Serializable, Cloneable {
/**
*
* The name of the template. You use 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 is visible to recipients whose email clients do not display HTML content.
*
*/
private String textPart;
/**
*
* The HTML body of the email.
*
*/
private String htmlPart;
/**
*
* The name of the template. You use this name when you send email using the SendTemplatedEmail
or
* SendBulkTemplatedEmail
operations.
*
*
* @param templateName
* The name of the template. You use 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 use this name when you send email using the SendTemplatedEmail
or
* SendBulkTemplatedEmail
operations.
*
*
* @return The name of the template. You use this name when you send email using the SendTemplatedEmail
* or SendBulkTemplatedEmail
operations.
*/
public String getTemplateName() {
return this.templateName;
}
/**
*
* The name of the template. You use this name when you send email using the SendTemplatedEmail
or
* SendBulkTemplatedEmail
operations.
*
*
* @param templateName
* The name of the template. You use this name when you send email using the SendTemplatedEmail
* or SendBulkTemplatedEmail
operations.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public Template withTemplateName(String templateName) {
setTemplateName(templateName);
return this;
}
/**
*
* 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.
*
*
* @return The subject line of the email.
*/
public String getSubjectPart() {
return this.subjectPart;
}
/**
*
* The subject line of the email.
*
*
* @param subjectPart
* The subject line of the email.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public Template withSubjectPart(String subjectPart) {
setSubjectPart(subjectPart);
return this;
}
/**
*
* The email body that is visible to recipients whose email clients do not display HTML content.
*
*
* @param textPart
* The email body that is visible to recipients whose email clients do not display HTML content.
*/
public void setTextPart(String textPart) {
this.textPart = textPart;
}
/**
*
* The email body that is visible to recipients whose email clients do not display HTML content.
*
*
* @return The email body that is visible to recipients whose email clients do not display HTML content.
*/
public String getTextPart() {
return this.textPart;
}
/**
*
* The email body that is visible to recipients whose email clients do not display HTML content.
*
*
* @param textPart
* The email body that is visible to recipients whose email clients do not display HTML content.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public Template withTextPart(String textPart) {
setTextPart(textPart);
return this;
}
/**
*
* 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.
*
*
* @return The HTML body of the email.
*/
public String getHtmlPart() {
return this.htmlPart;
}
/**
*
* The HTML body of the email.
*
*
* @param htmlPart
* The HTML body of the email.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public Template withHtmlPart(String htmlPart) {
setHtmlPart(htmlPart);
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 (getTemplateName() != null)
sb.append("TemplateName: ").append(getTemplateName()).append(",");
if (getSubjectPart() != null)
sb.append("SubjectPart: ").append(getSubjectPart()).append(",");
if (getTextPart() != null)
sb.append("TextPart: ").append(getTextPart()).append(",");
if (getHtmlPart() != null)
sb.append("HtmlPart: ").append(getHtmlPart());
sb.append("}");
return sb.toString();
}
@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;
}
@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 Template clone() {
try {
return (Template) super.clone();
} catch (CloneNotSupportedException e) {
throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
}
}
}