Skip to content

Package: AddressTerm

AddressTerm

nameinstructionbranchcomplexitylinemethod
AddressTerm(Address)
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%
equals(Object)
M: 2 C: 12
86%
M: 1 C: 1
50%
M: 1 C: 1
50%
M: 1 C: 3
75%
M: 0 C: 1
100%
getAddress()
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%
hashCode()
M: 4 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
match(Address)
M: 5 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.search;
18:
19: import jakarta.mail.Address;
20:
21: /**
22: * This class implements Message Address comparisons.
23: *
24: * @author Bill Shannon
25: * @author John Mani
26: */
27:
28: public abstract class AddressTerm extends SearchTerm {
29: /**
30: * The address.
31: *
32: * @serial
33: */
34: protected Address address;
35:
36: private static final long serialVersionUID = 2005405551929769980L;
37:
38: /**
39: * Constructor.
40: *
41: * @param address the address to match with.
42: */
43: protected AddressTerm(Address address) {
44: this.address = address;
45: }
46:
47: /**
48: * Return the address to match with.
49: *
50: * @return the adddress
51: */
52: public Address getAddress() {
53: return address;
54: }
55:
56: /**
57: * Match against the argument Address.
58: *
59: * @param a the address to match
60: * @return true if it matches
61: */
62: protected boolean match(Address a) {
63: return (a.equals(address));
64: }
65:
66: /**
67: * Equality comparison.
68: */
69: @Override
70: public boolean equals(Object obj) {
71:• if (!(obj instanceof AddressTerm))
72: return false;
73: AddressTerm at = (AddressTerm) obj;
74: return at.address.equals(this.address);
75: }
76:
77: /**
78: * Compute a hashCode for this object.
79: */
80: @Override
81: public int hashCode() {
82: return address.hashCode();
83: }
84: }