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.List; |
---|
23 | |
---|
24 | /** |
---|
25 | * Represents a MIME multipart body (see RFC 2045).A multipart body has a |
---|
26 | * ordered list of body parts. The multipart body also has a preamble and |
---|
27 | * epilogue. The preamble consists of whatever characters appear before the |
---|
28 | * first body part while the epilogue consists of whatever characters come after |
---|
29 | * the last body part. |
---|
30 | */ |
---|
31 | public interface Multipart extends Body { |
---|
32 | |
---|
33 | /** |
---|
34 | * Gets the multipart sub-type. E.g. <code>alternative</code> (the |
---|
35 | * default) or <code>parallel</code>. See RFC 2045 for common sub-types |
---|
36 | * and their meaning. |
---|
37 | * |
---|
38 | * @return the multipart sub-type. |
---|
39 | */ |
---|
40 | String getSubType(); |
---|
41 | |
---|
42 | /** |
---|
43 | * Returns the number of body parts. |
---|
44 | * |
---|
45 | * @return number of <code>Entity</code> objects. |
---|
46 | */ |
---|
47 | int getCount(); |
---|
48 | |
---|
49 | /** |
---|
50 | * Gets the list of body parts. The list is immutable. |
---|
51 | * |
---|
52 | * @return the list of <code>Entity</code> objects. |
---|
53 | */ |
---|
54 | public List<Entity> getBodyParts(); |
---|
55 | |
---|
56 | /** |
---|
57 | * Sets the list of body parts. |
---|
58 | * |
---|
59 | * @param bodyParts |
---|
60 | * the new list of <code>Entity</code> objects. |
---|
61 | */ |
---|
62 | void setBodyParts(List<Entity> bodyParts); |
---|
63 | |
---|
64 | /** |
---|
65 | * Adds a body part to the end of the list of body parts. |
---|
66 | * |
---|
67 | * @param bodyPart |
---|
68 | * the body part. |
---|
69 | */ |
---|
70 | void addBodyPart(Entity bodyPart); |
---|
71 | |
---|
72 | /** |
---|
73 | * Inserts a body part at the specified position in the list of body parts. |
---|
74 | * |
---|
75 | * @param bodyPart |
---|
76 | * the body part. |
---|
77 | * @param index |
---|
78 | * index at which the specified body part is to be inserted. |
---|
79 | * @throws IndexOutOfBoundsException |
---|
80 | * if the index is out of range (index < 0 || index > |
---|
81 | * getCount()). |
---|
82 | */ |
---|
83 | void addBodyPart(Entity bodyPart, int index); |
---|
84 | |
---|
85 | /** |
---|
86 | * Removes the body part at the specified position in the list of body |
---|
87 | * parts. |
---|
88 | * |
---|
89 | * @param index |
---|
90 | * index of the body part to be removed. |
---|
91 | * @return the removed body part. |
---|
92 | * @throws IndexOutOfBoundsException |
---|
93 | * if the index is out of range (index < 0 || index >= |
---|
94 | * getCount()). |
---|
95 | */ |
---|
96 | Entity removeBodyPart(int index); |
---|
97 | |
---|
98 | /** |
---|
99 | * Replaces the body part at the specified position in the list of body |
---|
100 | * parts with the specified body part. |
---|
101 | * |
---|
102 | * @param bodyPart |
---|
103 | * body part to be stored at the specified position. |
---|
104 | * @param index |
---|
105 | * index of body part to replace. |
---|
106 | * @return the replaced body part. |
---|
107 | * @throws IndexOutOfBoundsException |
---|
108 | * if the index is out of range (index < 0 || index >= |
---|
109 | * getCount()). |
---|
110 | */ |
---|
111 | Entity replaceBodyPart(Entity bodyPart, int index); |
---|
112 | |
---|
113 | /** |
---|
114 | * Gets the preamble or null if the message has no preamble. |
---|
115 | * |
---|
116 | * @return the preamble. |
---|
117 | */ |
---|
118 | String getPreamble(); |
---|
119 | |
---|
120 | /** |
---|
121 | * Sets the preamble with a value or null to remove the preamble. |
---|
122 | * |
---|
123 | * @param preamble |
---|
124 | * the preamble. |
---|
125 | */ |
---|
126 | void setPreamble(String preamble); |
---|
127 | |
---|
128 | /** |
---|
129 | * Gets the epilogue or null if the message has no epilogue |
---|
130 | * |
---|
131 | * @return the epilogue. |
---|
132 | */ |
---|
133 | String getEpilogue(); |
---|
134 | |
---|
135 | /** |
---|
136 | * Sets the epilogue value, or remove it if the value passed is null. |
---|
137 | * |
---|
138 | * @param epilogue |
---|
139 | * the epilogue. |
---|
140 | */ |
---|
141 | void setEpilogue(String epilogue); |
---|
142 | |
---|
143 | } |
---|