db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tfisc...@apache.org
Subject svn commit: r1337545 - /db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/SourceTransformerDefinition.java
Date Sat, 12 May 2012 13:56:26 GMT
Author: tfischer
Date: Sat May 12 13:56:26 2012
New Revision: 1337545

URL: http://svn.apache.org/viewvc?rev=1337545&view=rev
Log:
Use equalsBuilder and hashCodeBuilder

Modified:
    db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/SourceTransformerDefinition.java

Modified: db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/SourceTransformerDefinition.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/SourceTransformerDefinition.java?rev=1337545&r1=1337544&r2=1337545&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/SourceTransformerDefinition.java
(original)
+++ db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/SourceTransformerDefinition.java
Sat May 12 13:56:26 2012
@@ -19,6 +19,8 @@ package org.apache.torque.generator.sour
  * under the License.
  */
 
+import org.apache.commons.lang.builder.EqualsBuilder;
+import org.apache.commons.lang.builder.HashCodeBuilder;
 import org.apache.torque.generator.source.transform.SourceTransformer;
 
 /**
@@ -32,12 +34,12 @@ public final class SourceTransformerDefi
     /**
      * The transformer instance.
      */
-    private SourceTransformer sourceTransformer;
+    private final SourceTransformer sourceTransformer;
 
     /**
      * The path to the source elements on which the transformer is applied.
      */
-    private String elements;
+    private final String elements;
 
     /**
      * Constructor.
@@ -90,10 +92,10 @@ public final class SourceTransformerDefi
     @Override
     public int hashCode()
     {
-        int result = 1;
-        result = ((elements == null) ? 0 : elements.hashCode());
-        result = 31 * result + sourceTransformer.hashCode();
-        return result;
+        HashCodeBuilder hashCodeBuilder = new HashCodeBuilder()
+            .append(elements)
+            .append(sourceTransformer);
+        return hashCodeBuilder.toHashCode();
     }
 
     @Override
@@ -112,21 +114,9 @@ public final class SourceTransformerDefi
             return false;
         }
         SourceTransformerDefinition other = (SourceTransformerDefinition) obj;
-        if (elements == null)
-        {
-            if (other.elements != null)
-            {
-                return false;
-            }
-        }
-        else if (!elements.equals(other.elements))
-        {
-            return false;
-        }
-        if (!sourceTransformer.equals(other.sourceTransformer))
-        {
-            return false;
-        }
-        return true;
+        EqualsBuilder equalsBuilder = new EqualsBuilder()
+            .append(elements, other.elements)
+            .append(sourceTransformer, other.sourceTransformer);
+        return equalsBuilder.isEquals();
     }
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org


Mime
View raw message