Author: sebb
Date: Tue May 14 17:47:14 2013
New Revision: 1482485

URL: http://svn.apache.org/r1482485
Log:
DBUTILS-85 In BeanProcessor#isCompatibleType, can 
Integer.class.isInstance(value) be replaced by value instanceof Integer (etc)?
Simplified code by using instanceof.

Modified:
    commons/proper/dbutils/trunk/src/changes/changes.xml
    
commons/proper/dbutils/trunk/src/main/java/org/apache/commons/dbutils/BeanProcessor.java

Modified: commons/proper/dbutils/trunk/src/changes/changes.xml
URL: 
http://svn.apache.org/viewvc/commons/proper/dbutils/trunk/src/changes/changes.xml?rev=1482485&r1=1482484&r2=1482485&view=diff
==============================================================================
--- commons/proper/dbutils/trunk/src/changes/changes.xml (original)
+++ commons/proper/dbutils/trunk/src/changes/changes.xml Tue May 14 17:47:14 
2013
@@ -44,6 +44,10 @@ The <action> type attribute can be add,u
   </properties>
   <body>
     <release version="1.6" date="201?-??-??" description="Bugfixes and 
addition of insert methods">
+      <action dev="sebb" type="update" issue="DBUTILS-85">
+        In BeanProcessor#isCompatibleType, can Integer.class.isInstance(value) 
be replaced by value instanceof Integer (etc)?
+        Simplified code by using instanceof.
+      </action>
       <action dev="sebb" due-to="Niall Pemberton" type="fix" 
issue="DBUTILS-106">
         DBUtils can't build using JDK 1.7 - DriverProxy needs to implement 
getParentLogger()
         Add dynamic invocation.

Modified: 
commons/proper/dbutils/trunk/src/main/java/org/apache/commons/dbutils/BeanProcessor.java
URL: 
http://svn.apache.org/viewvc/commons/proper/dbutils/trunk/src/main/java/org/apache/commons/dbutils/BeanProcessor.java?rev=1482485&r1=1482484&r2=1482485&view=diff
==============================================================================
--- 
commons/proper/dbutils/trunk/src/main/java/org/apache/commons/dbutils/BeanProcessor.java
 (original)
+++ 
commons/proper/dbutils/trunk/src/main/java/org/apache/commons/dbutils/BeanProcessor.java
 Tue May 14 17:47:14 2013
@@ -306,28 +306,28 @@ public class BeanProcessor {
         if (value == null || type.isInstance(value)) {
             return true;
 
-        } else if (type.equals(Integer.TYPE) && 
Integer.class.isInstance(value)) {
+        } else if (type.equals(Integer.TYPE) && value instanceof Integer) {
             return true;
 
-        } else if (type.equals(Long.TYPE) && Long.class.isInstance(value)) {
+        } else if (type.equals(Long.TYPE) && value instanceof Long) {
             return true;
 
-        } else if (type.equals(Double.TYPE) && Double.class.isInstance(value)) 
{
+        } else if (type.equals(Double.TYPE) && value instanceof Double) {
             return true;
 
-        } else if (type.equals(Float.TYPE) && Float.class.isInstance(value)) {
+        } else if (type.equals(Float.TYPE) && value instanceof Float) {
             return true;
 
-        } else if (type.equals(Short.TYPE) && Short.class.isInstance(value)) {
+        } else if (type.equals(Short.TYPE) && value instanceof Short) {
             return true;
 
-        } else if (type.equals(Byte.TYPE) && Byte.class.isInstance(value)) {
+        } else if (type.equals(Byte.TYPE) && value instanceof Byte) {
             return true;
 
-        } else if (type.equals(Character.TYPE) && 
Character.class.isInstance(value)) {
+        } else if (type.equals(Character.TYPE) && value instanceof Character) {
             return true;
 
-        } else if (type.equals(Boolean.TYPE) && 
Boolean.class.isInstance(value)) {
+        } else if (type.equals(Boolean.TYPE) && value instanceof Boolean) {
             return true;
 
         }


Reply via email to