diff options
author | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2009-08-11 23:40:03 +0000 |
---|---|---|
committer | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2009-08-11 23:40:03 +0000 |
commit | c72ec59c45c45356fcd46d8fb754a18daf40be09 (patch) | |
tree | a4fccfe622e95352563c4056e5f21dd3aaf8768a /branches/sca-java-1.5.1/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLInterfaceImpl.java | |
parent | feffc12ba58e0ed5be7247157f2fca7440999dd3 (diff) |
Remove hashCode and equals methods in base OperationImpl and InterfaceImpl to improve performance (merged from 2.x)
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@803326 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to '')
-rw-r--r-- | branches/sca-java-1.5.1/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLInterfaceImpl.java | 54 |
1 files changed, 35 insertions, 19 deletions
diff --git a/branches/sca-java-1.5.1/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLInterfaceImpl.java b/branches/sca-java-1.5.1/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLInterfaceImpl.java index 3719bbd79a..e8379ee56b 100644 --- a/branches/sca-java-1.5.1/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLInterfaceImpl.java +++ b/branches/sca-java-1.5.1/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLInterfaceImpl.java @@ -61,25 +61,8 @@ public class WSDLInterfaceImpl extends InterfaceImpl implements WSDLInterface { public void setPortType(PortType portType) { this.portType = portType; - } - - @Override - public int hashCode() { - return String.valueOf(getName()).hashCode(); - } - - @Override - public boolean equals(Object obj) { - if (obj == this) { - return true; - } else if (obj instanceof WSDLInterface) { - if (getName() != null) { - return getName().equals(((WSDLInterface)obj).getName()); - } else { - return ((WSDLInterface)obj).getName() == null; - } - } else { - return false; + if (portType != null) { + this.name = portType.getQName(); } } @@ -96,4 +79,37 @@ public class WSDLInterfaceImpl extends InterfaceImpl implements WSDLInterface { return (WSDLInterfaceImpl) super.clone(); } + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((name == null) ? 0 : name.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; + WSDLInterfaceImpl other = (WSDLInterfaceImpl)obj; + if (isUnresolved() || other.isUnresolved()) { + if (name == null) { + if (other.name != null) + return false; + } else if (!name.equals(other.name)) + return false; + } else { + if (portType == null) { + if (other.portType != null) + return false; + } else if (!portType.equals(other.portType)) + return false; + } + return true; + } + } |