summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/impl/OSGiImplementationImpl.java
diff options
context:
space:
mode:
Diffstat (limited to 'sca-java-2.x/trunk/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/impl/OSGiImplementationImpl.java')
-rw-r--r--sca-java-2.x/trunk/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/impl/OSGiImplementationImpl.java59
1 files changed, 38 insertions, 21 deletions
diff --git a/sca-java-2.x/trunk/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/impl/OSGiImplementationImpl.java b/sca-java-2.x/trunk/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/impl/OSGiImplementationImpl.java
index 51e1e69b5d..4e89cbb7d3 100644
--- a/sca-java-2.x/trunk/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/impl/OSGiImplementationImpl.java
+++ b/sca-java-2.x/trunk/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/impl/OSGiImplementationImpl.java
@@ -75,27 +75,6 @@ public class OSGiImplementationImpl extends ImplementationImpl implements OSGiIm
}
}
- private boolean areEqual(Object obj1, Object obj2) {
- if (obj1 == obj2)
- return true;
- if (obj1 == null || obj2 == null)
- return false;
- return obj1.equals(obj2);
- }
-
- @Override
- public boolean equals(Object obj) {
-
- if (!(obj instanceof OSGiImplementationImpl))
- return super.equals(obj);
- OSGiImplementationImpl impl = (OSGiImplementationImpl)obj;
- if (!areEqual(bundleSymbolicName, impl.bundleSymbolicName))
- return false;
- if (!areEqual(bundleVersion, impl.bundleVersion))
- return false;
- return super.equals(obj);
- }
-
public void setBundleSymbolicName(String bundleSymbolicName) {
this.bundleSymbolicName = bundleSymbolicName;
}
@@ -104,4 +83,42 @@ public class OSGiImplementationImpl extends ImplementationImpl implements OSGiIm
this.bundleVersion = bundleVersion;
}
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = super.hashCode();
+ result = prime * result + ((bundleSymbolicName == null) ? 0 : bundleSymbolicName.hashCode());
+ result = prime * result + ((bundleVersion == null) ? 0 : bundleVersion.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (!super.equals(obj)) {
+ return false;
+ }
+ if (!(obj instanceof OSGiImplementationImpl)) {
+ return false;
+ }
+ OSGiImplementationImpl other = (OSGiImplementationImpl)obj;
+ if (bundleSymbolicName == null) {
+ if (other.bundleSymbolicName != null) {
+ return false;
+ }
+ } else if (!bundleSymbolicName.equals(other.bundleSymbolicName)) {
+ return false;
+ }
+ if (bundleVersion == null) {
+ if (other.bundleVersion != null) {
+ return false;
+ }
+ } else if (!bundleVersion.equals(other.bundleVersion)) {
+ return false;
+ }
+ return true;
+ }
+
}