You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by se...@apache.org on 2013/05/14 19:47:47 UTC
svn commit: r1482487 - in /commons/proper/dbutils/branches/2_0/src:
changes/changes.xml main/java/org/apache/commons/dbutils2/BeanProcessor.java
Author: sebb
Date: Tue May 14 17:47:47 2013
New Revision: 1482487
URL: http://svn.apache.org/r1482487
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/branches/2_0/src/changes/changes.xml
commons/proper/dbutils/branches/2_0/src/main/java/org/apache/commons/dbutils2/BeanProcessor.java
Modified: commons/proper/dbutils/branches/2_0/src/changes/changes.xml
URL: http://svn.apache.org/viewvc/commons/proper/dbutils/branches/2_0/src/changes/changes.xml?rev=1482487&r1=1482486&r2=1482487&view=diff
==============================================================================
--- commons/proper/dbutils/branches/2_0/src/changes/changes.xml (original)
+++ commons/proper/dbutils/branches/2_0/src/changes/changes.xml Tue May 14 17:47:47 2013
@@ -48,6 +48,10 @@ The <action> type attribute can be add,u
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.
Modified: commons/proper/dbutils/branches/2_0/src/main/java/org/apache/commons/dbutils2/BeanProcessor.java
URL: http://svn.apache.org/viewvc/commons/proper/dbutils/branches/2_0/src/main/java/org/apache/commons/dbutils2/BeanProcessor.java?rev=1482487&r1=1482486&r2=1482487&view=diff
==============================================================================
--- commons/proper/dbutils/branches/2_0/src/main/java/org/apache/commons/dbutils2/BeanProcessor.java (original)
+++ commons/proper/dbutils/branches/2_0/src/main/java/org/apache/commons/dbutils2/BeanProcessor.java Tue May 14 17:47:47 2013
@@ -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;
}