source: contrib/MailArchiver/sources/vendor/mime4j/custom/dom/src/main/java/org/apache/james/mime4j/dom/Header.java @ 6785

Revision 6785, 3.3 KB checked in by rafaelraymundo, 12 years ago (diff)

Ticket #2946 - Liberado codigo do MailArchiver?. Documentação na subpasta DOCS.

Line 
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
20package org.apache.james.mime4j.dom;
21
22import java.util.Iterator;
23import java.util.List;
24
25import org.apache.james.mime4j.dom.field.Field;
26
27/**
28 * The header of an entity (see RFC 2045).
29 */
30public interface Header extends Iterable<Field> {
31
32    /**
33     * Adds a field to the end of the list of fields.
34     *
35     * @param field the field to add.
36     */
37    void addField(Field field);
38   
39    /**
40     * Gets the fields of this header. The returned list will not be
41     * modifiable.
42     *
43     * @return the list of <code>Field</code> objects.
44     */
45    List<Field> getFields();
46
47    /**
48     * Gets a <code>Field</code> given a field name. If there are multiple
49     * such fields defined in this header the first one will be returned.
50     *
51     * @param name the field name (e.g. From, Subject).
52     * @return the field or <code>null</code> if none found.
53     */
54    Field getField(String name);
55   
56    /**
57     * Gets all <code>Field</code>s having the specified field name.
58     *
59     * @param name the field name (e.g. From, Subject).
60     * @return the list of fields.
61     */
62    List<Field> getFields(final String name);
63
64    /**
65     * Returns an iterator over the list of fields of this header.
66     *
67     * @return an iterator.
68     */
69    Iterator<Field> iterator();
70
71    /**
72     * Removes all <code>Field</code>s having the specified field name.
73     *
74     * @param name
75     *            the field name (e.g. From, Subject).
76     * @return number of fields removed.
77     */
78    int removeFields(String name);
79
80    /**
81     * Sets or replaces a field. This method is useful for header fields such as
82     * Subject or Message-ID that should not occur more than once in a message.
83     *
84     * If this <code>Header</code> does not already contain a header field of
85     * the same name as the given field then it is added to the end of the list
86     * of fields (same behavior as {@link #addField(Field)}). Otherwise the
87     * first occurrence of a field with the same name is replaced by the given
88     * field and all further occurrences are removed.
89     *
90     * @param field the field to set.
91     */
92    void setField(Field field);   
93}
Note: See TracBrowser for help on using the repository browser.