Skip to content

Package: Header

Header

nameinstructionbranchcomplexitylinemethod
Header(String, String)
M: 0 C: 9
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 4
100%
M: 0 C: 1
100%
equals(Object)
M: 0 C: 35
100%
M: 1 C: 9
90%
M: 1 C: 5
83%
M: 0 C: 8
100%
M: 0 C: 1
100%
getName()
M: 0 C: 3
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
getValue()
M: 0 C: 3
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
hashCode()
M: 14 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%

Coverage

1: /*
2: * Copyright (c) 1997, 2023 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 java.util.Objects;
20:
21: /**
22: * The Header class stores a name/value pair to represent headers.
23: *
24: * @author John Mani
25: */
26:
27: public class Header {
28:
29: /**
30: * The name of the header.
31: *
32: * @since JavaMail 1.4
33: */
34: protected String name;
35:
36: /**
37: * The value of the header.
38: *
39: * @since JavaMail 1.4
40: */
41: protected String value;
42:
43: /**
44: * Construct a Header object.
45: *
46: * @param name name of the header
47: * @param value value of the header
48: */
49: public Header(String name, String value) {
50: this.name = name;
51: this.value = value;
52: }
53:
54: /**
55: * Returns the name of this header.
56: *
57: * @return name of the header
58: */
59: public String getName() {
60: return name;
61: }
62:
63: /**
64: * Returns the value of this header.
65: *
66: * @return value of the header
67: */
68: public String getValue() {
69: return value;
70: }
71:
72: @Override
73: public int hashCode() {
74: return Objects.hash(name, value);
75: }
76:
77: @Override
78: public boolean equals(Object obj) {
79:• if (this == obj) {
80: return true;
81:• } else if (obj == null) {
82: return false;
83:• } else if (getClass() != obj.getClass()) {
84: return false;
85: } else {
86: Header other = (Header) obj;
87:• return Objects.equals(name, other.getName()) && Objects.equals(value, other.getValue());
88: }
89: }
90:
91: }