/**************************************************************** * Licensed to the Apache Software Foundation (ASF) under one * * or more contributor license agreements. See the NOTICE file * * distributed with this work for additional information * * regarding copyright ownership. The ASF licenses this file * * to you under the Apache License, Version 2.0 (the * * "License"); you may not use this file except in compliance * * with the License. You may obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, * * software distributed under the License 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 org.apache.james.mime4j.dom; import java.util.Collection; import java.util.Date; import java.util.TimeZone; import org.apache.james.mime4j.dom.address.Address; import org.apache.james.mime4j.dom.address.AddressList; import org.apache.james.mime4j.dom.address.Mailbox; import org.apache.james.mime4j.dom.address.MailboxList; public interface Message extends Entity, Body { /** * Returns the value of the Message-ID header field of this message * or null if it is not present. * * @return the identifier of this message. */ String getMessageId(); /** * Creates and sets a new Message-ID header field for this message. * A Header is created if this message does not already have * one. * * @param hostname * host name to be included in the identifier or * null if no host name should be included. */ void createMessageId(String hostname); /** * Returns the (decoded) value of the Subject header field of this * message or null if it is not present. * * @return the subject of this message. */ String getSubject(); /** * Sets the Subject header field for this message. The specified * string may contain non-ASCII characters, in which case it gets encoded as * an 'encoded-word' automatically. A Header is created if * this message does not already have one. * * @param subject * subject to set or null to remove the subject * header field. */ void setSubject(String subject); /** * Returns the value of the Date header field of this message as * Date object or null if it is not present. * * @return the date of this message. */ Date getDate(); /** * Sets the Date header field for this message. This method uses the * default TimeZone of this host to encode the specified * Date object into a string. * * @param date * date to set or null to remove the date header * field. */ void setDate(Date date); /** * Sets the Date header field for this message. The specified * TimeZone is used to encode the specified Date * object into a string. * * @param date * date to set or null to remove the date header * field. * @param zone * a time zone. */ void setDate(Date date, TimeZone zone); /** * Returns the value of the Sender header field of this message as * Mailbox object or null if it is not * present. * * @return the sender of this message. */ Mailbox getSender(); /** * Sets the Sender header field of this message to the specified * mailbox address. * * @param sender * address to set or null to remove the header * field. */ void setSender(Mailbox sender); /** * Returns the value of the From header field of this message as * MailboxList object or null if it is not * present. * * @return value of the from field of this message. */ MailboxList getFrom(); /** * Sets the From header field of this message to the specified * mailbox address. * * @param from * address to set or null to remove the header * field. */ void setFrom(Mailbox from); /** * Sets the From header field of this message to the specified * mailbox addresses. * * @param from * addresses to set or null or no arguments to * remove the header field. */ void setFrom(Mailbox... from); /** * Sets the From header field of this message to the specified * mailbox addresses. * * @param from * addresses to set or null or an empty collection * to remove the header field. */ void setFrom(Collection from); /** * Returns the value of the To header field of this message as * AddressList object or null if it is not * present. * * @return value of the to field of this message. */ AddressList getTo(); /** * Sets the To header field of this message to the specified * address. * * @param to * address to set or null to remove the header * field. */ void setTo(Address to); /** * Sets the To header field of this message to the specified * addresses. * * @param to * addresses to set or null or no arguments to * remove the header field. */ void setTo(Address... to); /** * Sets the To header field of this message to the specified * addresses. * * @param to * addresses to set or null or an empty collection * to remove the header field. */ void setTo(Collection
to); /** * Returns the value of the Cc header field of this message as * AddressList object or null if it is not * present. * * @return value of the cc field of this message. */ AddressList getCc(); /** * Sets the Cc header field of this message to the specified * address. * * @param cc * address to set or null to remove the header * field. */ void setCc(Address cc); /** * Sets the Cc header field of this message to the specified * addresses. * * @param cc * addresses to set or null or no arguments to * remove the header field. */ void setCc(Address... cc); /** * Sets the Cc header field of this message to the specified * addresses. * * @param cc * addresses to set or null or an empty collection * to remove the header field. */ void setCc(Collection
cc); /** * Returns the value of the Bcc header field of this message as * AddressList object or null if it is not * present. * * @return value of the bcc field of this message. */ AddressList getBcc(); /** * Sets the Bcc header field of this message to the specified * address. * * @param bcc * address to set or null to remove the header * field. */ void setBcc(Address bcc); /** * Sets the Bcc header field of this message to the specified * addresses. * * @param bcc * addresses to set or null or no arguments to * remove the header field. */ void setBcc(Address... bcc); /** * Sets the Bcc header field of this message to the specified * addresses. * * @param bcc * addresses to set or null or an empty collection * to remove the header field. */ void setBcc(Collection
bcc); /** * Returns the value of the Reply-To header field of this message as * AddressList object or null if it is not * present. * * @return value of the reply to field of this message. */ AddressList getReplyTo(); /** * Sets the Reply-To header field of this message to the specified * address. * * @param replyTo * address to set or null to remove the header * field. */ void setReplyTo(Address replyTo); /** * Sets the Reply-To header field of this message to the specified * addresses. * * @param replyTo * addresses to set or null or no arguments to * remove the header field. */ void setReplyTo(Address... replyTo); /** * Sets the Reply-To header field of this message to the specified * addresses. * * @param replyTo * addresses to set or null or an empty collection * to remove the header field. */ void setReplyTo(Collection
replyTo); }