summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk/modules/assembly/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'sca-java-2.x/trunk/modules/assembly/src/main/java')
-rw-r--r--sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentTypeImpl.java51
-rw-r--r--sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ImplementationImpl.java12
2 files changed, 42 insertions, 21 deletions
diff --git a/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentTypeImpl.java b/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentTypeImpl.java
index f18c852e69..b52c65ef8b 100644
--- a/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentTypeImpl.java
+++ b/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentTypeImpl.java
@@ -128,27 +128,6 @@ public class ComponentTypeImpl extends ExtensibleImpl implements ComponentType,
return service;
}
- @Override
- public int hashCode() {
- return String.valueOf(getURI()).hashCode();
- }
-
- @Override
- public boolean equals(Object obj) {
- if (obj == this) {
- return true;
- } else {
- if (obj instanceof ComponentType) {
- if (getURI() != null) {
- return getURI().equals(((ComponentType)obj).getURI());
- } else {
- return ((ComponentType)obj).getURI() == null;
- }
- } else {
- return false;
- }
- }
- }
public List<Intent> getRequiredIntents() {
return requiredIntents;
@@ -164,4 +143,34 @@ public class ComponentTypeImpl extends ExtensibleImpl implements ComponentType,
public void setExtensionType(ExtensionType type) {
}
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((uri == null) ? 0 : uri.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ ComponentTypeImpl other = (ComponentTypeImpl)obj;
+ if (uri == null) {
+ if (other.uri != null) {
+ return false;
+ }
+ } else if (!uri.equals(other.uri)) {
+ return false;
+ }
+ return true;
+ }
}
diff --git a/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ImplementationImpl.java b/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ImplementationImpl.java
index 20c7ea3206..599662727a 100644
--- a/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ImplementationImpl.java
+++ b/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ImplementationImpl.java
@@ -73,4 +73,16 @@ public abstract class ImplementationImpl extends ComponentTypeImpl implements Im
}
return impl;
}
+
+ // Override the ComponentTypeImpl.hashCode()
+ @Override
+ public int hashCode() {
+ return System.identityHashCode(this);
+ }
+
+ // Override the ComponentTypeImpl.equals()
+ @Override
+ public boolean equals(Object obj) {
+ return this == obj;
+ }
}