[6785] | 1 | /**************************************************************** |
---|
| 2 | * Licensed to the Apache Software Foundation (ASF) under one * |
---|
| 3 | * or more contributor license agreements. See the NOTICE file * |
---|
| 4 | * distributed with this work for additional information * |
---|
| 5 | * regarding copyright ownership. The ASF licenses this file * |
---|
| 6 | * to you under the Apache License, Version 2.0 (the * |
---|
| 7 | * "License"); you may not use this file except in compliance * |
---|
| 8 | * with the License. You may obtain a copy of the License at * |
---|
| 9 | * * |
---|
| 10 | * http://www.apache.org/licenses/LICENSE-2.0 * |
---|
| 11 | * * |
---|
| 12 | * Unless required by applicable law or agreed to in writing, * |
---|
| 13 | * software distributed under the License is distributed on an * |
---|
| 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * |
---|
| 15 | * KIND, either express or implied. See the License for the * |
---|
| 16 | * specific language governing permissions and limitations * |
---|
| 17 | * under the License. * |
---|
| 18 | ****************************************************************/ |
---|
| 19 | |
---|
| 20 | package org.apache.james.mime4j.dom; |
---|
| 21 | |
---|
| 22 | import java.util.Collection; |
---|
| 23 | import java.util.Date; |
---|
| 24 | import java.util.TimeZone; |
---|
| 25 | |
---|
| 26 | import org.apache.james.mime4j.dom.address.Address; |
---|
| 27 | import org.apache.james.mime4j.dom.address.AddressList; |
---|
| 28 | import org.apache.james.mime4j.dom.address.Mailbox; |
---|
| 29 | import org.apache.james.mime4j.dom.address.MailboxList; |
---|
| 30 | |
---|
| 31 | public interface Message extends Entity, Body { |
---|
| 32 | |
---|
| 33 | /** |
---|
| 34 | * Returns the value of the <i>Message-ID</i> header field of this message |
---|
| 35 | * or <code>null</code> if it is not present. |
---|
| 36 | * |
---|
| 37 | * @return the identifier of this message. |
---|
| 38 | */ |
---|
| 39 | String getMessageId(); |
---|
| 40 | |
---|
| 41 | /** |
---|
| 42 | * Creates and sets a new <i>Message-ID</i> header field for this message. |
---|
| 43 | * A <code>Header</code> is created if this message does not already have |
---|
| 44 | * one. |
---|
| 45 | * |
---|
| 46 | * @param hostname |
---|
| 47 | * host name to be included in the identifier or |
---|
| 48 | * <code>null</code> if no host name should be included. |
---|
| 49 | */ |
---|
| 50 | void createMessageId(String hostname); |
---|
| 51 | |
---|
| 52 | /** |
---|
| 53 | * Returns the (decoded) value of the <i>Subject</i> header field of this |
---|
| 54 | * message or <code>null</code> if it is not present. |
---|
| 55 | * |
---|
| 56 | * @return the subject of this message. |
---|
| 57 | */ |
---|
| 58 | String getSubject(); |
---|
| 59 | |
---|
| 60 | /** |
---|
| 61 | * Sets the <i>Subject</i> header field for this message. The specified |
---|
| 62 | * string may contain non-ASCII characters, in which case it gets encoded as |
---|
| 63 | * an 'encoded-word' automatically. A <code>Header</code> is created if |
---|
| 64 | * this message does not already have one. |
---|
| 65 | * |
---|
| 66 | * @param subject |
---|
| 67 | * subject to set or <code>null</code> to remove the subject |
---|
| 68 | * header field. |
---|
| 69 | */ |
---|
| 70 | void setSubject(String subject); |
---|
| 71 | |
---|
| 72 | /** |
---|
| 73 | * Returns the value of the <i>Date</i> header field of this message as |
---|
| 74 | * <code>Date</code> object or <code>null</code> if it is not present. |
---|
| 75 | * |
---|
| 76 | * @return the date of this message. |
---|
| 77 | */ |
---|
| 78 | Date getDate(); |
---|
| 79 | |
---|
| 80 | /** |
---|
| 81 | * Sets the <i>Date</i> header field for this message. This method uses the |
---|
| 82 | * default <code>TimeZone</code> of this host to encode the specified |
---|
| 83 | * <code>Date</code> object into a string. |
---|
| 84 | * |
---|
| 85 | * @param date |
---|
| 86 | * date to set or <code>null</code> to remove the date header |
---|
| 87 | * field. |
---|
| 88 | */ |
---|
| 89 | void setDate(Date date); |
---|
| 90 | |
---|
| 91 | /** |
---|
| 92 | * Sets the <i>Date</i> header field for this message. The specified |
---|
| 93 | * <code>TimeZone</code> is used to encode the specified <code>Date</code> |
---|
| 94 | * object into a string. |
---|
| 95 | * |
---|
| 96 | * @param date |
---|
| 97 | * date to set or <code>null</code> to remove the date header |
---|
| 98 | * field. |
---|
| 99 | * @param zone |
---|
| 100 | * a time zone. |
---|
| 101 | */ |
---|
| 102 | void setDate(Date date, TimeZone zone); |
---|
| 103 | |
---|
| 104 | /** |
---|
| 105 | * Returns the value of the <i>Sender</i> header field of this message as |
---|
| 106 | * <code>Mailbox</code> object or <code>null</code> if it is not |
---|
| 107 | * present. |
---|
| 108 | * |
---|
| 109 | * @return the sender of this message. |
---|
| 110 | */ |
---|
| 111 | Mailbox getSender(); |
---|
| 112 | |
---|
| 113 | /** |
---|
| 114 | * Sets the <i>Sender</i> header field of this message to the specified |
---|
| 115 | * mailbox address. |
---|
| 116 | * |
---|
| 117 | * @param sender |
---|
| 118 | * address to set or <code>null</code> to remove the header |
---|
| 119 | * field. |
---|
| 120 | */ |
---|
| 121 | void setSender(Mailbox sender); |
---|
| 122 | |
---|
| 123 | /** |
---|
| 124 | * Returns the value of the <i>From</i> header field of this message as |
---|
| 125 | * <code>MailboxList</code> object or <code>null</code> if it is not |
---|
| 126 | * present. |
---|
| 127 | * |
---|
| 128 | * @return value of the from field of this message. |
---|
| 129 | */ |
---|
| 130 | MailboxList getFrom(); |
---|
| 131 | |
---|
| 132 | /** |
---|
| 133 | * Sets the <i>From</i> header field of this message to the specified |
---|
| 134 | * mailbox address. |
---|
| 135 | * |
---|
| 136 | * @param from |
---|
| 137 | * address to set or <code>null</code> to remove the header |
---|
| 138 | * field. |
---|
| 139 | */ |
---|
| 140 | void setFrom(Mailbox from); |
---|
| 141 | |
---|
| 142 | /** |
---|
| 143 | * Sets the <i>From</i> header field of this message to the specified |
---|
| 144 | * mailbox addresses. |
---|
| 145 | * |
---|
| 146 | * @param from |
---|
| 147 | * addresses to set or <code>null</code> or no arguments to |
---|
| 148 | * remove the header field. |
---|
| 149 | */ |
---|
| 150 | void setFrom(Mailbox... from); |
---|
| 151 | |
---|
| 152 | /** |
---|
| 153 | * Sets the <i>From</i> header field of this message to the specified |
---|
| 154 | * mailbox addresses. |
---|
| 155 | * |
---|
| 156 | * @param from |
---|
| 157 | * addresses to set or <code>null</code> or an empty collection |
---|
| 158 | * to remove the header field. |
---|
| 159 | */ |
---|
| 160 | void setFrom(Collection<Mailbox> from); |
---|
| 161 | |
---|
| 162 | /** |
---|
| 163 | * Returns the value of the <i>To</i> header field of this message as |
---|
| 164 | * <code>AddressList</code> object or <code>null</code> if it is not |
---|
| 165 | * present. |
---|
| 166 | * |
---|
| 167 | * @return value of the to field of this message. |
---|
| 168 | */ |
---|
| 169 | AddressList getTo(); |
---|
| 170 | |
---|
| 171 | /** |
---|
| 172 | * Sets the <i>To</i> header field of this message to the specified |
---|
| 173 | * address. |
---|
| 174 | * |
---|
| 175 | * @param to |
---|
| 176 | * address to set or <code>null</code> to remove the header |
---|
| 177 | * field. |
---|
| 178 | */ |
---|
| 179 | void setTo(Address to); |
---|
| 180 | |
---|
| 181 | /** |
---|
| 182 | * Sets the <i>To</i> header field of this message to the specified |
---|
| 183 | * addresses. |
---|
| 184 | * |
---|
| 185 | * @param to |
---|
| 186 | * addresses to set or <code>null</code> or no arguments to |
---|
| 187 | * remove the header field. |
---|
| 188 | */ |
---|
| 189 | void setTo(Address... to); |
---|
| 190 | |
---|
| 191 | /** |
---|
| 192 | * Sets the <i>To</i> header field of this message to the specified |
---|
| 193 | * addresses. |
---|
| 194 | * |
---|
| 195 | * @param to |
---|
| 196 | * addresses to set or <code>null</code> or an empty collection |
---|
| 197 | * to remove the header field. |
---|
| 198 | */ |
---|
| 199 | void setTo(Collection<Address> to); |
---|
| 200 | |
---|
| 201 | /** |
---|
| 202 | * Returns the value of the <i>Cc</i> header field of this message as |
---|
| 203 | * <code>AddressList</code> object or <code>null</code> if it is not |
---|
| 204 | * present. |
---|
| 205 | * |
---|
| 206 | * @return value of the cc field of this message. |
---|
| 207 | */ |
---|
| 208 | AddressList getCc(); |
---|
| 209 | |
---|
| 210 | /** |
---|
| 211 | * Sets the <i>Cc</i> header field of this message to the specified |
---|
| 212 | * address. |
---|
| 213 | * |
---|
| 214 | * @param cc |
---|
| 215 | * address to set or <code>null</code> to remove the header |
---|
| 216 | * field. |
---|
| 217 | */ |
---|
| 218 | void setCc(Address cc); |
---|
| 219 | |
---|
| 220 | /** |
---|
| 221 | * Sets the <i>Cc</i> header field of this message to the specified |
---|
| 222 | * addresses. |
---|
| 223 | * |
---|
| 224 | * @param cc |
---|
| 225 | * addresses to set or <code>null</code> or no arguments to |
---|
| 226 | * remove the header field. |
---|
| 227 | */ |
---|
| 228 | void setCc(Address... cc); |
---|
| 229 | |
---|
| 230 | /** |
---|
| 231 | * Sets the <i>Cc</i> header field of this message to the specified |
---|
| 232 | * addresses. |
---|
| 233 | * |
---|
| 234 | * @param cc |
---|
| 235 | * addresses to set or <code>null</code> or an empty collection |
---|
| 236 | * to remove the header field. |
---|
| 237 | */ |
---|
| 238 | void setCc(Collection<Address> cc); |
---|
| 239 | |
---|
| 240 | /** |
---|
| 241 | * Returns the value of the <i>Bcc</i> header field of this message as |
---|
| 242 | * <code>AddressList</code> object or <code>null</code> if it is not |
---|
| 243 | * present. |
---|
| 244 | * |
---|
| 245 | * @return value of the bcc field of this message. |
---|
| 246 | */ |
---|
| 247 | AddressList getBcc(); |
---|
| 248 | |
---|
| 249 | /** |
---|
| 250 | * Sets the <i>Bcc</i> header field of this message to the specified |
---|
| 251 | * address. |
---|
| 252 | * |
---|
| 253 | * @param bcc |
---|
| 254 | * address to set or <code>null</code> to remove the header |
---|
| 255 | * field. |
---|
| 256 | */ |
---|
| 257 | void setBcc(Address bcc); |
---|
| 258 | |
---|
| 259 | /** |
---|
| 260 | * Sets the <i>Bcc</i> header field of this message to the specified |
---|
| 261 | * addresses. |
---|
| 262 | * |
---|
| 263 | * @param bcc |
---|
| 264 | * addresses to set or <code>null</code> or no arguments to |
---|
| 265 | * remove the header field. |
---|
| 266 | */ |
---|
| 267 | void setBcc(Address... bcc); |
---|
| 268 | |
---|
| 269 | /** |
---|
| 270 | * Sets the <i>Bcc</i> header field of this message to the specified |
---|
| 271 | * addresses. |
---|
| 272 | * |
---|
| 273 | * @param bcc |
---|
| 274 | * addresses to set or <code>null</code> or an empty collection |
---|
| 275 | * to remove the header field. |
---|
| 276 | */ |
---|
| 277 | void setBcc(Collection<Address> bcc); |
---|
| 278 | |
---|
| 279 | /** |
---|
| 280 | * Returns the value of the <i>Reply-To</i> header field of this message as |
---|
| 281 | * <code>AddressList</code> object or <code>null</code> if it is not |
---|
| 282 | * present. |
---|
| 283 | * |
---|
| 284 | * @return value of the reply to field of this message. |
---|
| 285 | */ |
---|
| 286 | AddressList getReplyTo(); |
---|
| 287 | |
---|
| 288 | /** |
---|
| 289 | * Sets the <i>Reply-To</i> header field of this message to the specified |
---|
| 290 | * address. |
---|
| 291 | * |
---|
| 292 | * @param replyTo |
---|
| 293 | * address to set or <code>null</code> to remove the header |
---|
| 294 | * field. |
---|
| 295 | */ |
---|
| 296 | void setReplyTo(Address replyTo); |
---|
| 297 | |
---|
| 298 | /** |
---|
| 299 | * Sets the <i>Reply-To</i> header field of this message to the specified |
---|
| 300 | * addresses. |
---|
| 301 | * |
---|
| 302 | * @param replyTo |
---|
| 303 | * addresses to set or <code>null</code> or no arguments to |
---|
| 304 | * remove the header field. |
---|
| 305 | */ |
---|
| 306 | void setReplyTo(Address... replyTo); |
---|
| 307 | |
---|
| 308 | /** |
---|
| 309 | * Sets the <i>Reply-To</i> header field of this message to the specified |
---|
| 310 | * addresses. |
---|
| 311 | * |
---|
| 312 | * @param replyTo |
---|
| 313 | * addresses to set or <code>null</code> or an empty collection |
---|
| 314 | * to remove the header field. |
---|
| 315 | */ |
---|
| 316 | void setReplyTo(Collection<Address> replyTo); |
---|
| 317 | |
---|
| 318 | } |
---|