2 * Copyright (C) 2016 Roland Haeder
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 package org.mxchange.jmailee.model.delivery.wrapper;
19 import java.util.Properties;
22 * A wrapper class for email delivery.
24 * @author Roland Haeder<roland@mxchange.org>
26 public class EmailDeliveryWrapper implements WrapableEmailDelivery {
31 private static final long serialVersionUID = 518_209_689_877_185_914L;
39 * Recipient email address
41 private String emailAddress;
44 * (Optional) properties
46 private Properties[] properties;
51 private String subjectLine;
54 * Constructor with email address (recipient), subject line, body and
57 * @param emailAddress Recipient's email address
58 * @param subjectLine Subject line
59 * @param body Body content
60 * @param properties Optional properties to e.g. override from address
62 public EmailDeliveryWrapper (final String emailAddress, final String subjectLine, final String body, final Properties[] properties) {
63 // Check all except properties as they are optional
64 if (null == emailAddress) {
66 throw new NullPointerException("emailAddress is null"); //NOI18N
67 } else if (emailAddress.trim().isEmpty()) {
69 throw new IllegalArgumentException("emailAddress is empty"); //NOI18N
70 } else if (null == subjectLine) {
72 throw new NullPointerException("subjectLine is null"); //NOI18N
73 } else if (subjectLine.trim().isEmpty()) {
75 throw new IllegalArgumentException("subjectLine is empty"); //NOI18N
76 } else if (null == body) {
78 throw new NullPointerException("body is null"); //NOI18N
79 } else if (body.trim().isEmpty()) {
81 throw new IllegalArgumentException("body is empty"); //NOI18N
85 this.emailAddress = emailAddress;
86 this.subjectLine = subjectLine;
88 this.properties = properties;
92 public String getBody () {
97 public void setBody (final String body) {
102 public String getEmailAddress () {
103 return this.emailAddress;
107 public void setEmailAddress (final String emailAddress) {
108 this.emailAddress = emailAddress;
112 @SuppressWarnings ("ReturnOfCollectionOrArrayField")
113 public Properties[] getProperties () {
114 return this.properties;
118 @SuppressWarnings ("AssignmentToCollectionOrArrayFieldFromParameter")
119 public void setProperties (final Properties[] properties) {
120 this.properties = properties;
124 public String getSubjectLine () {
125 return this.subjectLine;
129 public void setSubjectLine (final String subjectLine) {
130 this.subjectLine = subjectLine;