Skip to content

Package: BodyPart

BodyPart

nameinstructionbranchcomplexitylinemethod
BodyPart()
M: 0 C: 6
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 3
100%
M: 0 C: 1
100%
getParent()
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
setParent(Multipart)
M: 4 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%

Coverage

1: /*
2: * Copyright (c) 1997, 2021 Oracle and/or its affiliates. All rights reserved.
3: *
4: * This program and the accompanying materials are made available under the
5: * terms of the Eclipse Public License v. 2.0, which is available at
6: * http://www.eclipse.org/legal/epl-2.0.
7: *
8: * This Source Code may also be made available under the following Secondary
9: * Licenses when the conditions for such availability set forth in the
10: * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
11: * version 2 with the GNU Classpath Exception, which is available at
12: * https://www.gnu.org/software/classpath/license.html.
13: *
14: * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15: */
16:
17: package jakarta.mail;
18:
19: import jakarta.mail.util.StreamProvider;
20:
21: /**
22: * This class models a Part that is contained within a Multipart.
23: * This is an abstract class. Subclasses provide actual implementations.<p>
24: *
25: * BodyPart implements the Part interface. Thus, it contains a set of
26: * attributes and a "content".
27: *
28: * @author John Mani
29: * @author Bill Shannon
30: */
31:
32: public abstract class BodyPart implements Part {
33:
34: /**
35: * The <code>Multipart</code> object containing this <code>BodyPart</code>,
36: * if known.
37: * @since        JavaMail 1.1
38: */
39: protected Multipart parent;
40:
41: /**
42: * Instance of stream provider.
43: *
44: * @since JavaMail 2.1
45: */
46: protected final StreamProvider streamProvider = StreamProvider.provider();
47:
48: /**
49: * Creates a default {@code BodyPart}.
50: */
51: public BodyPart() {
52: }
53:
54: /**
55: * Return the containing <code>Multipart</code> object,
56: * or <code>null</code> if not known.
57: *
58: * @return        the parent Multipart
59: */
60: public Multipart getParent() {
61:         return parent;
62: }
63:
64: /**
65: * Set the parent of this <code>BodyPart</code> to be the specified
66: * <code>Multipart</code>. Normally called by <code>Multipart</code>'s
67: * <code>addBodyPart</code> method. <code>parent</code> may be
68: * <code>null</code> if the <code>BodyPart</code> is being removed
69: * from its containing <code>Multipart</code>.
70: * @since        JavaMail 1.1
71: */
72: void setParent(Multipart parent) {
73:         this.parent = parent;
74: }
75: }