Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
|
| 1.0;1 |
1 | package org.jtheque.utils.bean; | |
2 | ||
3 | /* | |
4 | * This file is part of JTheque. | |
5 | * | |
6 | * JTheque is free software: you can redistribute it and/or modify | |
7 | * it under the terms of the GNU General Public License as published by | |
8 | * the Free Software Foundation, either version 3 of the License. | |
9 | * | |
10 | * JTheque is distributed in the hope that it will be useful, | |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | * GNU General Public License for more details. | |
14 | * | |
15 | * You should have received a copy of the GNU General Public License | |
16 | * along with JTheque. If not, see <http://www.gnu.org/licenses/>. | |
17 | */ | |
18 | ||
19 | import java.io.File; | |
20 | import java.util.ArrayList; | |
21 | import java.util.Arrays; | |
22 | import java.util.Collection; | |
23 | ||
24 | /** | |
25 | * An email. | |
26 | * | |
27 | * @author Baptiste Wicht | |
28 | */ | |
29 | 0 | public final class Email { |
30 | private String from; | |
31 | private String[] to; | |
32 | private String subject; | |
33 | private String message; | |
34 | 0 | private final Collection<File> attachedFiles = new ArrayList<File>(5); |
35 | ||
36 | /** | |
37 | * Return the from address. | |
38 | * | |
39 | * @return The address from. | |
40 | */ | |
41 | public String getFrom() { | |
42 | 0 | return from; |
43 | } | |
44 | ||
45 | /** | |
46 | * Set the from address. | |
47 | * | |
48 | * @param from The from address. | |
49 | */ | |
50 | public void setFrom(String from) { | |
51 | 0 | this.from = from; |
52 | 0 | } |
53 | ||
54 | /** | |
55 | * Return the message. | |
56 | * | |
57 | * @return The message. | |
58 | */ | |
59 | public String getMessage() { | |
60 | 0 | return message; |
61 | } | |
62 | ||
63 | /** | |
64 | * Set the message. | |
65 | * | |
66 | * @param message The message to set. | |
67 | */ | |
68 | public void setMessage(String message) { | |
69 | 0 | this.message = message; |
70 | 0 | } |
71 | ||
72 | /** | |
73 | * Return the subject. | |
74 | * | |
75 | * @return The subject. | |
76 | */ | |
77 | public String getSubject() { | |
78 | 0 | return subject; |
79 | } | |
80 | ||
81 | /** | |
82 | * Set the subject. | |
83 | * | |
84 | * @param subject The subject. | |
85 | */ | |
86 | public void setSubject(String subject) { | |
87 | 0 | this.subject = subject; |
88 | 0 | } |
89 | ||
90 | /** | |
91 | * Return the to addresses. | |
92 | * | |
93 | * @return A array of String containing all the addresses to. | |
94 | */ | |
95 | public String[] getTo() { | |
96 | 0 | return Arrays.copyOf(to, to.length); |
97 | } | |
98 | ||
99 | /** | |
100 | * Set the addresses to. | |
101 | * | |
102 | * @param to An array containing all the destination addresses. | |
103 | */ | |
104 | public void setTo(String[] to) { | |
105 | 0 | this.to = Arrays.copyOf(to, to.length); |
106 | 0 | } |
107 | ||
108 | /** | |
109 | * Attach a file to the mail. | |
110 | * | |
111 | * @param f The file to attach. | |
112 | */ | |
113 | public void attachFile(File f) { | |
114 | 0 | attachedFiles.add(f); |
115 | 0 | } |
116 | ||
117 | /** | |
118 | * Attach files to the mail. | |
119 | * | |
120 | * @param c The collection of files to attach to the mail. | |
121 | */ | |
122 | public void attachFiles(Collection<File> c) { | |
123 | 0 | attachedFiles.addAll(c); |
124 | 0 | } |
125 | ||
126 | /** | |
127 | * Return the files attached to the mail. | |
128 | * | |
129 | * @return A List containing all the files attached to the mail. | |
130 | */ | |
131 | public Collection<File> getAttachedFiles() { | |
132 | 0 | return attachedFiles; |
133 | } | |
134 | } |