summaryrefslogtreecommitdiffstats
path: root/src/main
diff options
context:
space:
mode:
authorJames Moger <james.moger@gitblit.com>2014-10-06 12:12:41 -0400
committerJames Moger <james.moger@gitblit.com>2014-10-06 12:12:41 -0400
commit40ad76e1db008923cd089b0dde80590156fa0596 (patch)
treea76f96d22a48ada60f6a2b6c0174884a54c2ddf0 /src/main
parent8eed45f5117065995cbceb7ae2a96c9057a806bd (diff)
downloadiciql-40ad76e1db008923cd089b0dde80590156fa0596.tar.gz
iciql-40ad76e1db008923cd089b0dde80590156fa0596.zip
Support mapping SQL BOOLEAN -> primitive numeric types
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/com/iciql/util/Utils.java18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/main/java/com/iciql/util/Utils.java b/src/main/java/com/iciql/util/Utils.java
index 92ca825..64fe6b3 100644
--- a/src/main/java/com/iciql/util/Utils.java
+++ b/src/main/java/com/iciql/util/Utils.java
@@ -273,10 +273,22 @@ public class Utils {
// convert from boolean to number
if (Boolean.class.isAssignableFrom(currentType)) {
Boolean b = (Boolean) o;
+ Integer n = b ? 1 : 0;
if (Number.class.isAssignableFrom(targetType)) {
- return b ? 1 : 0;
- }
- if (boolean.class.isAssignableFrom(targetType)) {
+ return n.intValue();
+ } else if (byte.class.isAssignableFrom(targetType)) {
+ return n.byteValue();
+ } else if (short.class.isAssignableFrom(targetType)) {
+ return n.shortValue();
+ } else if (int.class.isAssignableFrom(targetType)) {
+ return n.intValue();
+ } else if (long.class.isAssignableFrom(targetType)) {
+ return n.longValue();
+ } else if (float.class.isAssignableFrom(targetType)) {
+ return n.floatValue();
+ } else if (double.class.isAssignableFrom(targetType)) {
+ return n.doubleValue();
+ } else if (boolean.class.isAssignableFrom(targetType)) {
return b.booleanValue();
}
}