[jboss-cvs] JBossAS SVN: r110372 - projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ds.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Jan 14 10:08:17 EST 2011


Author: maeste
Date: 2011-01-14 10:08:17 -0500 (Fri, 14 Jan 2011)
New Revision: 110372

Modified:
   projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ds/DataSourceAbstractImpl.java
   projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ds/DataSourceImpl.java
   projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ds/XADataSourceImpl.java
Log:
fixing hashcode and equals

Modified: projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ds/DataSourceAbstractImpl.java
===================================================================
--- projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ds/DataSourceAbstractImpl.java	2011-01-14 14:29:34 UTC (rev 110371)
+++ projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ds/DataSourceAbstractImpl.java	2011-01-14 15:08:17 UTC (rev 110372)
@@ -255,4 +255,109 @@
          this.validation.validate();
    }
 
+   @Override
+   public int hashCode()
+   {
+      final int prime = 31;
+      int result = 1;
+      result = prime * result + ((enabled == null) ? 0 : enabled.hashCode());
+      result = prime * result + ((jndiName == null) ? 0 : jndiName.hashCode());
+      result = prime * result + ((poolName == null) ? 0 : poolName.hashCode());
+      result = prime * result + ((security == null) ? 0 : security.hashCode());
+      result = prime * result + ((statement == null) ? 0 : statement.hashCode());
+      result = prime * result + ((timeOut == null) ? 0 : timeOut.hashCode());
+      result = prime * result + ((transactionIsolation == null) ? 0 : transactionIsolation.hashCode());
+      result = prime * result + ((urlDelimiter == null) ? 0 : urlDelimiter.hashCode());
+      result = prime * result +
+               ((urlSelectorStrategyClassName == null) ? 0 : urlSelectorStrategyClassName.hashCode());
+      result = prime * result + ((useJavaContext == null) ? 0 : useJavaContext.hashCode());
+      result = prime * result + ((validation == null) ? 0 : validation.hashCode());
+      return result;
+   }
+
+   @Override
+   public boolean equals(Object obj)
+   {
+      if (this == obj)
+         return true;
+      if (obj == null)
+         return false;
+      if (!(obj instanceof DataSourceAbstractImpl))
+         return false;
+      DataSourceAbstractImpl other = (DataSourceAbstractImpl) obj;
+      if (enabled == null)
+      {
+         if (other.enabled != null)
+            return false;
+      }
+      else if (!enabled.equals(other.enabled))
+         return false;
+      if (jndiName == null)
+      {
+         if (other.jndiName != null)
+            return false;
+      }
+      else if (!jndiName.equals(other.jndiName))
+         return false;
+      if (poolName == null)
+      {
+         if (other.poolName != null)
+            return false;
+      }
+      else if (!poolName.equals(other.poolName))
+         return false;
+      if (security == null)
+      {
+         if (other.security != null)
+            return false;
+      }
+      else if (!security.equals(other.security))
+         return false;
+      if (statement == null)
+      {
+         if (other.statement != null)
+            return false;
+      }
+      else if (!statement.equals(other.statement))
+         return false;
+      if (timeOut == null)
+      {
+         if (other.timeOut != null)
+            return false;
+      }
+      else if (!timeOut.equals(other.timeOut))
+         return false;
+      if (transactionIsolation != other.transactionIsolation)
+         return false;
+      if (urlDelimiter == null)
+      {
+         if (other.urlDelimiter != null)
+            return false;
+      }
+      else if (!urlDelimiter.equals(other.urlDelimiter))
+         return false;
+      if (urlSelectorStrategyClassName == null)
+      {
+         if (other.urlSelectorStrategyClassName != null)
+            return false;
+      }
+      else if (!urlSelectorStrategyClassName.equals(other.urlSelectorStrategyClassName))
+         return false;
+      if (useJavaContext == null)
+      {
+         if (other.useJavaContext != null)
+            return false;
+      }
+      else if (!useJavaContext.equals(other.useJavaContext))
+         return false;
+      if (validation == null)
+      {
+         if (other.validation != null)
+            return false;
+      }
+      else if (!validation.equals(other.validation))
+         return false;
+      return true;
+   }
+
 }

Modified: projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ds/DataSourceImpl.java
===================================================================
--- projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ds/DataSourceImpl.java	2011-01-14 14:29:34 UTC (rev 110371)
+++ projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ds/DataSourceImpl.java	2011-01-14 15:08:17 UTC (rev 110372)
@@ -208,7 +208,7 @@
    public int hashCode()
    {
       final int prime = 31;
-      int result = 1;
+      int result = super.hashCode();
       result = prime * result + ((connectionProperties == null) ? 0 : connectionProperties.hashCode());
       result = prime * result + ((connectionUrl == null) ? 0 : connectionUrl.hashCode());
       result = prime * result + ((driverClass == null) ? 0 : driverClass.hashCode());
@@ -223,7 +223,7 @@
    {
       if (this == obj)
          return true;
-      if (obj == null)
+      if (!super.equals(obj))
          return false;
       if (!(obj instanceof DataSourceImpl))
          return false;

Modified: projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ds/XADataSourceImpl.java
===================================================================
--- projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ds/XADataSourceImpl.java	2011-01-14 14:29:34 UTC (rev 110371)
+++ projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/ds/XADataSourceImpl.java	2011-01-14 15:08:17 UTC (rev 110372)
@@ -171,10 +171,10 @@
    public int hashCode()
    {
       final int prime = 31;
-      int result = 1;
+      int result = super.hashCode();
+      result = prime * result + ((module == null) ? 0 : module.hashCode());
       result = prime * result + ((newConnectionSql == null) ? 0 : newConnectionSql.hashCode());
       result = prime * result + ((xaDataSourceClass == null) ? 0 : xaDataSourceClass.hashCode());
-      result = prime * result + ((module == null) ? 0 : module.hashCode());
       result = prime * result + ((xaDataSourceProperty == null) ? 0 : xaDataSourceProperty.hashCode());
       result = prime * result + ((xaPool == null) ? 0 : xaPool.hashCode());
       return result;
@@ -185,11 +185,18 @@
    {
       if (this == obj)
          return true;
-      if (obj == null)
+      if (!super.equals(obj))
          return false;
       if (!(obj instanceof XADataSourceImpl))
          return false;
       XADataSourceImpl other = (XADataSourceImpl) obj;
+      if (module == null)
+      {
+         if (other.module != null)
+            return false;
+      }
+      else if (!module.equals(other.module))
+         return false;
       if (newConnectionSql == null)
       {
          if (other.newConnectionSql != null)
@@ -204,13 +211,6 @@
       }
       else if (!xaDataSourceClass.equals(other.xaDataSourceClass))
          return false;
-      if (module == null)
-      {
-         if (other.module != null)
-            return false;
-      }
-      else if (!module.equals(other.module))
-         return false;
       if (xaDataSourceProperty == null)
       {
          if (other.xaDataSourceProperty != null)



More information about the jboss-cvs-commits mailing list