Skip to content

Package: BundleKeyWrapper

BundleKeyWrapper

nameinstructionbranchcomplexitylinemethod
BundleKeyWrapper(String, Bundle)
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: 51 C: 0
0%
M: 18 C: 0
0%
M: 10 C: 0
0%
M: 18 C: 0
0%
M: 1 C: 0
0%
getBundle()
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%
getKey()
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: 32 C: 0
0%
M: 4 C: 0
0%
M: 3 C: 0
0%
M: 5 C: 0
0%
M: 1 C: 0
0%

Coverage

1: /*******************************************************************************
2: * Copyright (c) 2011-2015 EclipseSource Muenchen GmbH and others.
3: *
4: * All rights reserved. This program and the accompanying materials
5: * are made available under the terms of the Eclipse Public License 2.0
6: * which accompanies this distribution, and is available at
7: * https://www.eclipse.org/legal/epl-2.0/
8: *
9: * SPDX-License-Identifier: EPL-2.0
10: *
11: * Contributors:
12: * Eugen Neufeld - initial API and implementation
13: ******************************************************************************/
14: package org.eclipse.emfforms.internal.core.services.label;
15:
16: import org.osgi.framework.Bundle;
17:
18: /**
19: * Key for the map of displayname observables.
20: *
21: * @author Eugen Neufeld
22: */
23: class BundleKeyWrapper {
24:         private final String key;
25:         private final Bundle bundle;
26:
27:         /**
28:          * The default constructor.
29:          *
30:          * @param key The Key
31:          * @param bundle The Bundle
32:          */
33:         BundleKeyWrapper(String key, Bundle bundle) {
34:                 super();
35:                 this.key = key;
36:                 this.bundle = bundle;
37:         }
38:
39:         /**
40:          * The Key.
41:          *
42:          * @return The key
43:          */
44:         public String getKey() {
45:                 return key;
46:         }
47:
48:         /**
49:          * The Bundle.
50:          *
51:          * @return The bundle
52:          */
53:         public Bundle getBundle() {
54:                 return bundle;
55:         }
56:
57:         @Override
58:         public int hashCode() {
59:                 final int prime = 31;
60:                 int result = 1;
61:•                result = prime * result + (bundle == null ? 0 : bundle.hashCode());
62:•                result = prime * result + (key == null ? 0 : key.hashCode());
63:                 return result;
64:         }
65:
66:         @Override
67:         public boolean equals(Object obj) {
68:•                if (this == obj) {
69:                         return true;
70:                 }
71:•                if (obj == null) {
72:                         return false;
73:                 }
74:•                if (!(obj instanceof BundleKeyWrapper)) {
75:                         return false;
76:                 }
77:                 final BundleKeyWrapper other = (BundleKeyWrapper) obj;
78:•                if (bundle == null) {
79:•                        if (other.bundle != null) {
80:                                 return false;
81:                         }
82:•                } else if (!bundle.equals(other.bundle)) {
83:                         return false;
84:                 }
85:•                if (key == null) {
86:•                        if (other.key != null) {
87:                                 return false;
88:                         }
89:•                } else if (!key.equals(other.key)) {
90:                         return false;
91:                 }
92:                 return true;
93:         }
94: }