You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-dev@db.apache.org by ar...@apache.org on 2007/05/15 17:27:12 UTC
svn commit: r538214 - in /db/ojb/trunk/src/java/org/apache/ojb/broker:
Identity.java core/ValueContainer.java
Author: arminw
Date: Tue May 15 08:27:11 2007
New Revision: 538214
URL: http://svn.apache.org/viewvc?view=rev&rev=538214
Log:
optimize imports, comments, source
Modified:
db/ojb/trunk/src/java/org/apache/ojb/broker/Identity.java
db/ojb/trunk/src/java/org/apache/ojb/broker/core/ValueContainer.java
Modified: db/ojb/trunk/src/java/org/apache/ojb/broker/Identity.java
URL: http://svn.apache.org/viewvc/db/ojb/trunk/src/java/org/apache/ojb/broker/Identity.java?view=diff&rev=538214&r1=538213&r2=538214
==============================================================================
--- db/ojb/trunk/src/java/org/apache/ojb/broker/Identity.java (original)
+++ db/ojb/trunk/src/java/org/apache/ojb/broker/Identity.java Tue May 15 08:27:11 2007
@@ -101,7 +101,7 @@
differs in different JVM
*/
private transient String m_stringRepresentation = null;
- private transient Integer m_hashCode;
+ private transient int m_hashCode;
/**
* For internal use only!
@@ -318,7 +318,7 @@
identity is quasi immutable (toplevel class and PK fields
never change), thus we can note hashCode
*/
- if(m_hashCode == null)
+ if(m_hashCode == 0)
{
int iTotal = persistenceState;
Object obj;
@@ -331,13 +331,13 @@
}
else
{
- iTotal = iTotal * iConstant + (obj != null ? obj.hashCode() : 0);
+ iTotal += (obj != null ? obj.hashCode() : 0);
}
}
- iTotal = iTotal * iConstant + m_objectsTopLevelClass.hashCode();
- m_hashCode = new Integer(iTotal);
+ iTotal += m_objectsTopLevelClass.hashCode();
+ m_hashCode = iTotal;
}
- return m_hashCode.intValue();
+ return m_hashCode;
}
private ClassNotPersistenceCapableException createException(String msg, final Object objectToIdentify, final Exception e)
Modified: db/ojb/trunk/src/java/org/apache/ojb/broker/core/ValueContainer.java
URL: http://svn.apache.org/viewvc/db/ojb/trunk/src/java/org/apache/ojb/broker/core/ValueContainer.java?view=diff&rev=538214&r1=538213&r2=538214
==============================================================================
--- db/ojb/trunk/src/java/org/apache/ojb/broker/core/ValueContainer.java (original)
+++ db/ojb/trunk/src/java/org/apache/ojb/broker/core/ValueContainer.java Tue May 15 08:27:11 2007
@@ -18,7 +18,6 @@
import java.io.Serializable;
import org.apache.commons.lang.ClassUtils;
-import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.ojb.broker.metadata.JdbcType;
/**
@@ -27,7 +26,6 @@
* {@link JdbcType}.
* <br/>
* For internal use only!
- * <br/>
*
* @version $Id$
*/
@@ -99,7 +97,12 @@
public int hashCode()
{
- if(hc == 0) hc = new HashCodeBuilder().append(jdbcType).append(value).toHashCode();
+ if(hc == 0)
+ {
+ int hash = value != null ? value.hashCode() : 0;
+ hash += jdbcType != null ? jdbcType.hashCode() : 0;
+ hc = hash;
+ }
return hc;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org