db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tfisc...@apache.org
Subject svn commit: r1327904 - /db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/JdbcTypedValue.java
Date Thu, 19 Apr 2012 11:47:08 GMT
Author: tfischer
Date: Thu Apr 19 11:47:08 2012
New Revision: 1327904

URL: http://svn.apache.org/viewvc?rev=1327904&view=rev
Log:
implement hashCode and equals on JdbcTypedValue

Modified:
    db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/JdbcTypedValue.java

Modified: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/JdbcTypedValue.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/JdbcTypedValue.java?rev=1327904&r1=1327903&r2=1327904&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/JdbcTypedValue.java
(original)
+++ db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/JdbcTypedValue.java
Thu Apr 19 11:47:08 2012
@@ -1,5 +1,8 @@
 package org.apache.torque.util;
 
+import org.apache.commons.lang.builder.EqualsBuilder;
+import org.apache.commons.lang.builder.HashCodeBuilder;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -84,6 +87,37 @@ public class JdbcTypedValue
     }
 
     @Override
+    public int hashCode()
+    {
+        HashCodeBuilder hashCodeBuilder = new HashCodeBuilder()
+            .append(jdbcType)
+            .append(value);
+        return hashCodeBuilder.toHashCode();
+    }
+
+    @Override
+    public boolean equals(Object obj)
+    {
+        if (this == obj)
+        {
+            return true;
+        }
+        if (obj == null)
+        {
+            return false;
+        }
+        if (getClass() != obj.getClass())
+        {
+            return false;
+        }
+        JdbcTypedValue other = (JdbcTypedValue) obj;
+        EqualsBuilder equalsBuilder = new EqualsBuilder()
+            .append(jdbcType, other.jdbcType)
+            .append(value, other.value);
+        return equalsBuilder.isEquals();
+    }
+
+    @Override
     public String toString()
     {
         return "JdbcTypedValue [jdbcType=" + jdbcType



---------------------------------------------------------------------
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