You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by th...@apache.org on 2017/07/07 02:07:18 UTC

[56/58] [abbrv] commons-dbutils git commit: DBUTILS-85 In BeanProcessor#isCompatibleType, can Integer.class.isInstance(value) be replaced by value instanceof Integer (etc)? Simplified code by using instanceof.

DBUTILS-85 In BeanProcessor#isCompatibleType, can Integer.class.isInstance(value) be replaced by value instanceof Integer (etc)?
Simplified code by using instanceof.

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/dbutils/branches/2_0@1482487 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/commons-dbutils/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-dbutils/commit/4aca205a
Tree: http://git-wip-us.apache.org/repos/asf/commons-dbutils/tree/4aca205a
Diff: http://git-wip-us.apache.org/repos/asf/commons-dbutils/diff/4aca205a

Branch: refs/heads/2_0
Commit: 4aca205af58324f2cd049f543055865852b7ce5a
Parents: c5d4dd8
Author: Sebastian Bazley <se...@apache.org>
Authored: Tue May 14 17:47:47 2013 +0000
Committer: Sebastian Bazley <se...@apache.org>
Committed: Tue May 14 17:47:47 2013 +0000

----------------------------------------------------------------------
 src/changes/changes.xml                             |  4 ++++
 .../org/apache/commons/dbutils2/BeanProcessor.java  | 16 ++++++++--------
 2 files changed, 12 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-dbutils/blob/4aca205a/src/changes/changes.xml
----------------------------------------------------------------------
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 788596f..db34662 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -48,6 +48,10 @@ The <action> type attribute can be add,update,fix,remove.
  This is the first release of the 2.x branch of the Commons DbUtils package, DbUtils2.
  The motivation for creating DbUtils2 was two-fold: a number of deprecated methods in the original DbUtils, and the desire to support named parameters (DBUTILS-105).
     ">
+      <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" type="fix" issue="DBUTILS-106">
         DBUtils can't build using JDK 1.7 - DriverProxy needs to implement getParentLogger()
         Add dynamic invocation. 

http://git-wip-us.apache.org/repos/asf/commons-dbutils/blob/4aca205a/src/main/java/org/apache/commons/dbutils2/BeanProcessor.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/dbutils2/BeanProcessor.java b/src/main/java/org/apache/commons/dbutils2/BeanProcessor.java
index 6e621b5..41f747a 100644
--- a/src/main/java/org/apache/commons/dbutils2/BeanProcessor.java
+++ b/src/main/java/org/apache/commons/dbutils2/BeanProcessor.java
@@ -310,28 +310,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;
 
         }