summaryrefslogtreecommitdiffstats
path: root/java/sca/modules/interface
diff options
context:
space:
mode:
authorrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2009-08-11 05:14:38 +0000
committerrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2009-08-11 05:14:38 +0000
commit9ddddc3a89771fccd40bd6a7d4e5a3357dae10ab (patch)
tree078a26d3f9f4c4fc0e62759bfc57bd50bac46163 /java/sca/modules/interface
parentda54af6fa3cbdc88a5c07451697e071710a500ad (diff)
Remove hashCode and equals methods in base OperationImpl and InterfaceImpl to improve performance
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@802989 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/sca/modules/interface')
-rw-r--r--java/sca/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceImpl.java40
-rw-r--r--java/sca/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/OperationImpl.java66
-rw-r--r--java/sca/modules/interface/src/test/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceContractTestCase.java4
3 files changed, 3 insertions, 107 deletions
diff --git a/java/sca/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceImpl.java b/java/sca/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceImpl.java
index b6def5a42e..67aae7da4d 100644
--- a/java/sca/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceImpl.java
+++ b/java/sca/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceImpl.java
@@ -252,46 +252,6 @@ public class InterfaceImpl implements Interface {
return copy;
}
- /**
- * @see java.lang.Object#hashCode()
- */
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + (conversational ? 1231 : 1237);
- result = prime * result + ((operations == null) ? 0 : operations.hashCode());
- result = prime * result + (remotable ? 1231 : 1237);
- result = prime * result + (unresolved ? 1231 : 1237);
- return result;
- }
-
- /**
- * @see java.lang.Object#equals(java.lang.Object)
- */
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- final InterfaceImpl other = (InterfaceImpl)obj;
- if (conversational != other.conversational)
- return false;
- if (operations == null) {
- if (other.operations != null)
- return false;
- } else if (!operations.equals(other.operations))
- return false;
- if (remotable != other.remotable)
- return false;
- if (unresolved != other.unresolved)
- return false;
- return true;
- }
-
public Map<Object, Object> getAttributes() {
return attributes;
}
diff --git a/java/sca/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/OperationImpl.java b/java/sca/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/OperationImpl.java
index 7a4b62c4ac..26144e92cb 100644
--- a/java/sca/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/OperationImpl.java
+++ b/java/sca/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/OperationImpl.java
@@ -173,72 +173,6 @@ public class OperationImpl implements Operation {
this.nonBlocking = nonBlocking;
}
- @Override
- public int hashCode() {
- final int PRIME = 31;
- int result = 1;
- result = PRIME * result + ((conversationSequence == null) ? 0 : conversationSequence.hashCode());
- // result = PRIME * result + ((faultTypes == null) ? 0 :
- // faultTypes.hashCode());
- result = PRIME * result + ((inputType == null) ? 0 : inputType.hashCode());
- result = PRIME * result + ((name == null) ? 0 : name.hashCode());
- result = PRIME * result + (nonBlocking ? 1231 : 1237);
- result = PRIME * result + ((outputType == null) ? 0 : outputType.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;
- }
- final OperationImpl other = (OperationImpl)obj;
- if (conversationSequence == null) {
- if (other.conversationSequence != null) {
- return false;
- }
- } else if (!conversationSequence.equals(other.conversationSequence)) {
- return false;
- }
- /*
- * if (faultTypes == null) { if (other.faultTypes != null) { return
- * false; } } else if (!faultTypes.equals(other.faultTypes)) { return
- * false; }
- */
-
- if (inputType == null) {
- if (other.inputType != null) {
- return false;
- }
- } else if (!inputType.equals(other.inputType)) {
- return false;
- }
- if (name == null) {
- if (other.name != null) {
- return false;
- }
- } else if (!name.equals(other.name)) {
- return false;
- }
- if (nonBlocking != other.nonBlocking) {
- return false;
- }
- if (outputType == null) {
- if (other.outputType != null) {
- return false;
- }
- } else if (!outputType.equals(other.outputType)) {
- return false;
- }
- return true;
- }
-
/**
* @return the wrapperInfo
*/
diff --git a/java/sca/modules/interface/src/test/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceContractTestCase.java b/java/sca/modules/interface/src/test/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceContractTestCase.java
index c02b4657d3..d1faa5cf2b 100644
--- a/java/sca/modules/interface/src/test/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceContractTestCase.java
+++ b/java/sca/modules/interface/src/test/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceContractTestCase.java
@@ -51,7 +51,9 @@ public class InterfaceContractTestCase {
@Test
public void testClone() throws Exception {
InterfaceContract copy = (InterfaceContract) contract.clone();
- Assert.assertEquals(contract, copy);
+ Assert.assertNotNull(copy);
+ Assert.assertNotSame(copy.getCallbackInterface(), contract.getCallbackInterface());
+ Assert.assertNotSame(copy.getInterface(), contract.getInterface());
}
private static class MockInterfaceContract extends InterfaceContractImpl implements InterfaceContract {