org.rajivprab.sava.email.EmailInfo Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sava Show documentation
Show all versions of sava Show documentation
Enable Java programmers to integrate external services, libraries and modules,
with minimal difficulty or complexity.
package org.rajivprab.sava.email;
import java.util.Optional;
/**
* Builder for the EmailInfo object, which is then used by the Email interface
*
* Created by rprabhakar on 4/22/16.
*/
public class EmailInfo {
private final String toEmail;
private final String title;
private final String body;
private final String fromEmail;
private String replyToEmail;
private String toName = "";
private String fromName = "";
private String subAccount = null;
private String bccEmail = null;
EmailInfo(String toEmail, String title, String body, String fromEmail) {
this.toEmail = toEmail;
this.title = title;
this.body = body;
this.fromEmail = fromEmail;
this.replyToEmail = fromEmail;
}
// ---- Setters ------
public EmailInfo replyToEmail(String replyToEmail) {
this.replyToEmail = replyToEmail;
return this;
}
public EmailInfo subAccount(String subAccount) {
this.subAccount = subAccount;
return this;
}
public EmailInfo fromName(String fromName) {
this.fromName = fromName;
return this;
}
public EmailInfo bccEmail(String bccEmail) {
this.bccEmail = bccEmail;
return this;
}
public EmailInfo toName(String toName) {
this.toName = toName;
return this;
}
// --- Getters ----
public String getToEmail() {
return toEmail;
}
public String getTitle() {
return title;
}
public String getBody() {
return body;
}
public String getFromEmail() {
return fromEmail;
}
public String getReplyToEmail() {
return replyToEmail;
}
public String getToName() {
return toName;
}
public String getFromName() {
return fromName;
}
public Optional getSubAccount() {
return Optional.ofNullable(subAccount);
}
public Optional getBccEmail() {
return Optional.ofNullable(bccEmail);
}
@Override
public String toString() {
return "EmailInfo{" +
"toEmail='" + toEmail + '\'' +
", title='" + title + '\'' +
", body='" + body + '\'' +
", fromEmail='" + fromEmail + '\'' +
", replyToEmail='" + replyToEmail + '\'' +
", toName='" + toName + '\'' +
", fromName='" + fromName + '\'' +
", subAccount='" + subAccount + '\'' +
", bccEmail='" + bccEmail + '\'' +
'}';
}
}